Skip to content

Commit

Permalink
refactor(dockerfile): add volume instruction and --link flak to copy …
Browse files Browse the repository at this point in the history
…instruction (#401)
  • Loading branch information
borjapazr committed Oct 13, 2023
1 parent e25dd03 commit b9e5215
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# syntax=docker/dockerfile:1.6-labs

FROM node:18-buster-slim as base
ARG NODE_VERSION=18

FROM node:${NODE_VERSION}-buster-slim as base

LABEL maintainer="Borja Paz Rodríguez <borjapazr@gmail.com>" \
version="2.7.1" \
Expand Down Expand Up @@ -37,14 +39,14 @@ WORKDIR /app

FROM base as builder

COPY package*.json ./
COPY --link package*.json ./

RUN <<EOF
npm ci --omit=optional
npm cache clean --force
EOF

COPY . .
COPY --link . .

RUN <<EOF
npm run prisma:generate
Expand All @@ -58,13 +60,14 @@ FROM base as runtime
ARG PORT=5000
ENV PORT $PORT
EXPOSE $PORT
VOLUME ["/app/logs"]

RUN mkdir logs

COPY --from=builder /app/node_modules /app/node_modules
COPY --from=builder /app/dist /app

COPY <<EOF process.json
COPY --link <<EOF process.json
{ "apps": [{ "exec_mode": "cluster", "instances": "max", "name": "express-typescript-skeleton", "script": "./index.js" }] }
EOF

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:
- TZ=${TZ}
- WAIT_HOSTS=express-typescript-skeleton-postgres:5432
volumes:
- ${LOGS_VOLUME}:/home/node/app/logs
- ${LOGS_VOLUME}:/app/logs
ports:
- ${EXTERNAL_PORT}:${PORT}

Expand Down

0 comments on commit b9e5215

Please sign in to comment.