37 lines
846 B
Docker
37 lines
846 B
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# ---- Compile SCSS to CSS (public/stylesheets is gitignored, not built by npm ci) ----
|
|
FROM node:24.18.0-alpine3.24 AS assets
|
|
|
|
WORKDIR /usr/src/app
|
|
COPY package*.json ./
|
|
RUN npm ci --silent
|
|
COPY public/sass ./public/sass
|
|
RUN npm run sass:build:prod
|
|
|
|
# ---- Production image ----
|
|
FROM node:24.18.0-alpine3.24
|
|
|
|
# Curl is used in cron batch file.
|
|
RUN apk --no-cache add curl
|
|
|
|
# TODO: consider running as a non-root USER (both here and in the dev Dockerfile).
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci --omit=dev --silent
|
|
|
|
COPY . .
|
|
RUN rm -rf public/sass
|
|
COPY --from=assets /usr/src/app/public/stylesheets ./public/stylesheets
|
|
|
|
COPY scheduled/crontab /var/spool/cron/crontabs/root
|
|
RUN which crond && \
|
|
rm -rf /etc/periodic && \
|
|
chmod 0744 scheduled/entrypoint.sh
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["node", "bin/www"]
|