34 lines
722 B
Docker
34 lines
722 B
Docker
# Builds the required node packages.
|
|
FROM node:25 AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY src/package*.json ./
|
|
|
|
RUN npm install
|
|
|
|
FROM node:25 AS production
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
|
|
COPY src/* ./
|
|
|
|
# Sets users and permissions.
|
|
RUN groupadd --system --gid 1001 sysmailer && \
|
|
useradd --uid 1001 --gid 1001 -M -N --system sysmailer
|
|
|
|
COPY --from=builder --chown=sysmailer:sysmailer /app /app
|
|
|
|
# De-escelates permissions for improved security.
|
|
USER sysmailer
|
|
|
|
# Defines the expected outputs.
|
|
EXPOSE 6868
|
|
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD node -e "require('http').get('http://localhost:8080', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })"
|
|
|
|
CMD ["npm", "start"]
|