Skip to content

Commit

Permalink
Merge pull request #130 from letehaha/fix/docker-prod-build
Browse files Browse the repository at this point in the history
fix: Prod docker build
  • Loading branch information
letehaha committed Sep 15, 2024
2 parents cc6a520 + 0d2e591 commit d39deff
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docker/dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COPY . .

# Install dependencies
RUN chmod +x ./post-install.sh
RUN npm ci
RUN npm ci --also=dev

ENV NODE_ENV=development

Expand Down
2 changes: 1 addition & 1 deletion docker/prod/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ ENV NODE_ENV=production

# Install dependencies
RUN chmod +x ./post-install.sh
RUN npm ci
RUN npm ci --also=dev

CMD ["/bin/sh", "-c", "npm run prod"]
7 changes: 7 additions & 0 deletions docker/prod/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
services:
backend:
image: letehaha/budget-tracker-be
ports:
- '8081:8081'
environment:
- NODE_ENV=production
2 changes: 1 addition & 1 deletion docker/test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ COPY package*.json ./
COPY post-install.sh ./
COPY docker ./docker
RUN chmod +x ./post-install.sh
RUN npm ci
RUN npm ci --also=dev

# Copy the rest of the application
COPY . .
Expand Down
3 changes: 1 addition & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"docker:dev:destroy": "./docker/dev/docker-destroy.sh",
"docker:dev:run-in-container": "docker compose --env-file .env.development -f ./docker/dev/docker-compose.yml exec app",
"docker:prod:build": "docker build . -t letehaha/budget-tracker-be -f ./docker/prod/Dockerfile",
"docker:prod:preview": "docker compose --env-file .env.development -f ./docker/prod/docker-compose.yml up -d",
"docker:prod:push": "docker push letehaha/budget-tracker-be",
"docker:prod:build-push": "npm run docker-build && npm run docker-push",
"postinstall": "chmod +x ./post-install.sh && ./post-install.sh",
Expand Down

0 comments on commit d39deff

Please sign in to comment.