2024-10-31 14:17:58 -04:00
|
|
|
FROM node:lts-slim
|
2024-10-30 12:24:34 -04:00
|
|
|
|
2024-11-04 05:15:00 -05:00
|
|
|
# Install wget for healthcheck
|
|
|
|
RUN apt-get update && \
|
|
|
|
apt-get install -y wget && \
|
|
|
|
apt-get clean && \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
2024-10-30 12:24:34 -04:00
|
|
|
WORKDIR /app
|
|
|
|
|
2024-11-03 05:22:38 -05:00
|
|
|
COPY app/ ./
|
2024-11-01 03:55:54 -04:00
|
|
|
|
2024-11-02 17:18:04 -04:00
|
|
|
RUN npm install pm2 -g
|
2024-10-30 12:24:34 -04:00
|
|
|
|
2024-11-03 05:22:38 -05:00
|
|
|
RUN chown -R node:node /app
|
|
|
|
|
|
|
|
USER node
|
|
|
|
|
|
|
|
RUN npm install --omit=dev
|
2024-10-30 12:24:34 -04:00
|
|
|
|
2024-11-03 09:19:12 -05:00
|
|
|
ARG PACKAGE_VERSION
|
|
|
|
ENV APP_VERSION=${PACKAGE_VERSION}
|
2024-11-01 14:02:31 -04:00
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
2024-11-01 03:55:54 -04:00
|
|
|
# Build without type checking, as we have removed the Typescript
|
2024-11-03 14:28:37 -05:00
|
|
|
# dev-dependencies above to save space in the final build.
|
|
|
|
# Type checking is done in the repo before building the image.
|
2024-11-01 03:55:54 -04:00
|
|
|
RUN npx tsc --noCheck
|
2024-10-30 12:24:34 -04:00
|
|
|
|
2024-11-17 10:26:40 -05:00
|
|
|
HEALTHCHECK --interval=30s --start-period=10s --timeout=5s CMD wget -q --spider http://localhost:3000/share/healthcheck || exit 1
|
2024-11-02 18:13:32 -04:00
|
|
|
|
2024-11-02 17:18:04 -04:00
|
|
|
CMD ["pm2-runtime", "dist/index.js" ]
|