Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
fix: use shell method in ENTRYPOINT in order to capture ENV (#92)
Browse files Browse the repository at this point in the history
* fix: use shell method in ENTRYPOINT in order to capture ENV

* fix: apply Dockerfile standards for GW
  • Loading branch information
JoeCap08055 authored Apr 18, 2024
1 parent 66d585a commit be2918e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Use a multi-stage build for efficiency
FROM node:20 AS builder

WORKDIR /usr/src/app
WORKDIR /app

COPY package*.json ./

Expand All @@ -15,16 +15,24 @@ RUN npm run build
# Production stage
FROM node:20

WORKDIR /usr/src/app
WORKDIR /app

COPY --from=builder /usr/src/app/dist ./dist
COPY --from=builder /app/dist ./dist
COPY package*.json ./
COPY ./lua ./lua
COPY ./scripts/docker-entrypoint.sh ./
RUN chmod +x ./docker-entrypoint.sh

RUN npm install --only=production
RUN npm ci --omit=dev

# We want jq and curl in the final image, but we don't need the support files
RUN apt-get update && \
apt-get install -y jq curl tini && \
apt-get clean && \
rm -rf /usr/share/doc /usr/share/man /usr/share/zsh

EXPOSE 3000

ENV START_PROCESS="api"

ENTRYPOINT ["npm", "run", "start:${START_PROCESS}:prod"]
ENTRYPOINT ["/usr/bin/tini", "--", "./docker-entrypoint.sh"]
2 changes: 0 additions & 2 deletions docker-compose.dev.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
redis:
image: redis:latest
Expand Down
4 changes: 4 additions & 0 deletions scripts/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

# Wrapper script to launch the containerized app because we need to parse the environment
exec npm run start:${START_PROCESS}:prod -- $@

0 comments on commit be2918e

Please sign in to comment.