Skip to content

Commit

Permalink
fix: remove the script for auto-generating Dockerfile-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
amirhossein-haerian committed Dec 2, 2024
1 parent e162c90 commit 350030b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Dockerfile-dev
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ EXPOSE 3000

ENV TZ Europe/Stockholm

CMD ["npm", "run", "docker:start"]
CMD ["npm", "run", "start-dev]
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ This will execute the `docker-run-image.sh` script in development mode `(dev)`,

The application now will be accessible at http://localhost:3000/student/kurser/kurs/:courseCode.

#### Alternative approach for running locally using Docker

alternatively you can run the following command:

```sh
docker-compose up
```

Here you need to remove the .in at the end of the `docker-compose.yml.in`.

#### Notes

- Run `az acr login --name kthregistry` before running the scripts.
Expand Down
14 changes: 4 additions & 10 deletions docker-build-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,18 @@ DOCKERFILE="Dockerfile-dev"
if [ "$ENV" == "dev" ]; then

echo
echoYellow " 1. Creating Dockerfile-dev for development environment\n"

cp Dockerfile "$DOCKERFILE"
sed -i '' 's/CMD \["npm", "start"\]/CMD ["npm", "run", "docker:start"]/g' "$DOCKERFILE"

echo
echoYellow " 2. Stop previous Docker image: a name tag is $IMAGE_NAME\n"
echoYellow " 1. Stop previous Docker image: a name tag is $IMAGE_NAME\n"
docker stop "$IMAGE_NAME"

echo
echoYellow " 3. Remove previous Docker image: a name tag is $IMAGE_NAME\n"
echoYellow " 2. Remove previous Docker image: a name tag is $IMAGE_NAME\n"
docker rmi "$IMAGE_NAME"

echo
echoYellow " 4. Build Docker image: a name tag is $IMAGE_NAME\n"
echoYellow " 3. Build Docker image: a name tag is $IMAGE_NAME\n"
docker build -f Dockerfile-dev -t "$IMAGE_NAME" .

echo
echoYellow " 5. List images\n"
echoYellow " 4. List images\n"
docker images
fi
2 changes: 1 addition & 1 deletion docker-compose.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ services:
# Build from Dockerfile-dev in current directory
build:
context: .
dockerfile: Dockerfile-dev # if it does not exist you can generate it by runing the docker-build-image.sh script
dockerfile: Dockerfile-dev

environment:
# Cellus Deployment
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"build-dev": "bash ./build.sh dev",
"docker:build": "bash ./docker-build-image.sh dev",
"docker:run": "bash ./docker-run-image.sh dev",
"docker:start": "bash -c 'cat /KTH_NODEJS; NODE_ENV=development node app.js'",
"test": "NODE_ENV=test jest",
"test-win": "cross-env NODE_ENV=test jest",
"test:watch": "jest --watch",
Expand Down

0 comments on commit 350030b

Please sign in to comment.