Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 24 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:22
FROM node:22 AS base

# Define build arguments
ARG VERSION=dev
Expand Down Expand Up @@ -26,15 +26,31 @@ WORKDIR /usr/src/app
# where available (npm@5+)
COPY package*.json ./

# Install the app dependencies
RUN npm ci --only=production

# Copy app source
COPY . .

# Set version as environment variable for runtime access
ENV APP_VERSION=${VERSION} \
GIT_COMMIT=${REVISION} \
BUILD_DATE=${BUILDTIME}

CMD [ "npm", "start" ]
FROM base AS dev

# Install all dependencies, including file-watching development tools.
RUN npm ci

# Copy app source
COPY . .
RUN mkdir -p /usr/src/app-seed && \
cp -R app /usr/src/app-seed/app && \
cp -R bin /usr/src/app-seed/bin && \
cp -R resources /usr/src/app-seed/resources

CMD [ "sh", "-c", "if [ ! -f app/index.js ]; then cp -R /usr/src/app-seed/app/. app/; fi; if [ ! -f bin/www ]; then cp -R /usr/src/app-seed/bin/. bin/; fi; if [ ! -d resources ] || [ -z \"$(ls -A resources 2>/dev/null)\" ]; then mkdir -p resources && cp -R /usr/src/app-seed/resources/. resources/; fi; exec npm run start:dev" ]

FROM base AS production

# Install the app dependencies
RUN npm ci --omit=dev

# Copy app source
COPY . .

CMD [ "npm", "start" ]
252 changes: 252 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"prettier:fix": "npm run prettier -- --write",
"format": "npm run prettier:fix && npm run lint:fix",
"start": "node ./bin/www",
"start:dev": "nodemon --legacy-watch --watch app --watch bin --watch resources ./bin/www",
"test": "npm run test:openapi && npm run test:config && npm run test:api && npm run test:middleware",
"test:api": "mocha --timeout 20000 --recursive ./app/tests/api",
"test:config": "mocha --timeout 20000 --recursive ./app/tests/config",
Expand Down Expand Up @@ -89,6 +90,7 @@
"json-diff": "^1.0.6",
"mocha": "^11.5.0",
"mongodb-memory-server": "^10.1.4",
"nodemon": "^3.1.14",
"openapi-schema-validator": "^12.1.3",
"parse5": "^7.3.0",
"parse5-query-domtree": "^1.0.2",
Expand Down
Loading