Skip to content

Commit

Permalink
fix: docker and stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiin committed Sep 20, 2023
1 parent 14e440b commit 3601c83
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 106 deletions.
9 changes: 8 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ services:
# - "traefik.http.middlewares.security-headers.headers.accessControlAllowCredentials=true" # Add control allow credentials header
# - "traefik.http.middlewares.security-headers.headers.accesscontrolallowheaders=*" # Add control allow credentials header
# - "traefik.http.middlewares.security-headers.headers.accesscontrolmaxage=3600" # Set value for Access-Control-Max-Age header
# - "traefik.http.middlewares.security-headers.headers.addvaryheader=true" # Add Vary header to responses
# - "traefik.http.middlewares.security-headers.headers.addvaryheader=true" # Add Vary header to responses
- "traefik.http.middlewares.security-headers.headers.framedeny=true" # Enable frame denial for clickjacking protection
- "traefik.http.middlewares.security-headers.headers.contenttypenosniff=true" # Enable Content-Type nosniff
- "traefik.http.middlewares.security-headers.headers.browserxssfilter=false" # Enable browser XSS filter
Expand Down Expand Up @@ -185,6 +185,13 @@ services:
volumes:
- /usr/src/app/node_modules

healthcheck:
test: curl --fail http://localhost:3000 || exit 1
interval: 30s
timeout: 30s
retries: 10


# RabbitMQ service
# This service runs the RabbitMQ message broker
rabbitmq:
Expand Down
1 change: 1 addition & 0 deletions docker/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ WORKDIR /usr/src/app
RUN npm i -g pnpm
# pnpm fetch does require only lockfile
COPY pnpm-lock.yaml package.json ./
RUN apt-get -y update && apt-get -y install curl
RUN --mount=type=cache,id=pnpm,target=/usr/app/.pnpm-store/v3 pnpm fetch
# add source code
COPY . ./
Expand Down
10 changes: 1 addition & 9 deletions docker/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM node:20.6.1-slim AS base

RUN npm i -g pnpm
## https://engineeringblog.yelp.com/2016/01/dumb-init-an-init-for-docker.html
RUN apt-get update && apt-get install -y dumb-init wget
RUN apt-get update && apt-get install -y dumb-init curl

## ======================================================> The deps image stage
FROM base AS dependencies
Expand All @@ -29,14 +29,6 @@ RUN ( wget -q -O /dev/stdout https://gobinaries.com/tj/node-prune | sh ) \
## ======================================================> The production image stage
FROM base AS deploy

ARG PORT=8000
ENV PORT=$PORT
EXPOSE $PORT


HEALTHCHECK --interval=10m --timeout=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:$PORT || exit 1

WORKDIR /app
COPY --from=build /app/dist/ ./dist/
COPY --from=build /app/node_modules ./node_modules
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@
"passport-magic-login": "^1.2.2",
"pino-http": "^8.5.0",
"pino-pretty": "^10.2.0",
"poolifier": "^2.6.45",
"poolifier": "^2.7.0",
"preview-email": "^3.0.19",
"prom-client": "^14.2.0",
"pug": "^3.0.2",
"qrcode": "^1.5.3",
"read-pkg": "^8.1.0",
"redis": "^4.6.8",
"redis": "^4.6.9",
"reflect-metadata": "0.1.13",
"rxjs": "^7.8.1",
"socket.io": "^4.7.2",
Expand Down Expand Up @@ -158,7 +158,7 @@
"@types/jest": "^29.5.5",
"@types/mime-types": "^2.1.1",
"@types/multer": "^1.4.7",
"@types/node": "^20.6.2",
"@types/node": "^20.6.3",
"@types/nodemailer": "^6.4.10",
"@types/passport": "^1.0.12",
"@types/passport-facebook": "^3.0.0",
Expand Down
Loading

0 comments on commit 3601c83

Please sign in to comment.