Skip to content

Commit

Permalink
VPS - Adjusted docker structure
Browse files Browse the repository at this point in the history
  • Loading branch information
vladokuskov committed Jun 7, 2024
1 parent 1df45a5 commit 0245d76
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:

- name: Build Docker image 🐳
run: |
docker build -f docker/app.Dockerfile .
docker build --build-arg PORT=8081 -f docker/app.Dockerfile .
2 changes: 1 addition & 1 deletion .github/workflows/prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROD_IMAGE_NAME }};
docker stop prod-minddaily-frontend || true;
docker rm prod-minddaily-frontend || true;
docker run -d --name prod-minddaily-frontend -p 8081:8081 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROD_IMAGE_NAME }};
docker run -e PORT=8081 -d --name prod-minddaily-frontend -p 8081:8081 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_PROD_IMAGE_NAME }};
exit
"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_STAGE_IMAGE_NAME }};
docker stop stage-minddaily-frontend || true;
docker rm stage-minddaily-frontend || true;
docker run -d --name stage-minddaily-frontend -p 8081:8081 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_STAGE_IMAGE_NAME }};
docker run -e PORT=8082 -d --name stage-minddaily-frontend -p 8082:8082 ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_STAGE_IMAGE_NAME }};
exit
"
Expand Down
13 changes: 6 additions & 7 deletions docker/app.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ RUN apk add --no-cache git
WORKDIR /app
COPY package*.json ./
RUN yarn install
EXPOSE 8081

FROM base as builder

WORKDIR /app
COPY . .
RUN yarn build

FROM base as development
FROM base as runtime
WORKDIR /app

ENV NODE_ENV=production
RUN yarn install

RUN addgroup -g 1001 -S nodejs
Expand All @@ -27,9 +25,10 @@ COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/public ./public

EXPOSE 8081
# Default port to expose
ARG PORT=8081
ENV PORT=${PORT}

ENV PORT 8081
ENV HOSTNAME="0.0.0.0"
EXPOSE ${PORT}

CMD ["yarn", "start", "-p", "8081"]
CMD ["sh", "-c", "yarn start -p ${PORT}"]

0 comments on commit 0245d76

Please sign in to comment.