-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (26 loc) · 1018 Bytes
/
Dockerfile
File metadata and controls
41 lines (26 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
ARG NODE_VERSION=24
ARG BUN_VERSION=1
FROM oven/bun:${BUN_VERSION}-alpine AS builder
WORKDIR /usr/src/app
COPY bun.lock package.json ./
RUN bun install --frozen-lockfile --production
FROM node:${NODE_VERSION}-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production \
MJML_PORT=15500
RUN apk add --no-cache \
# For proper signal handling
dumb-init && \
rm -rf /var/cache/apk/*
RUN addgroup -g 1001 -S nodejs && \
adduser -S nodejs -u 1001 -G nodejs
COPY --from=builder --chown=nodejs:nodejs /usr/src/app/node_modules ./node_modules
COPY --chown=nodejs:nodejs package.json ./
COPY --chown=nodejs:nodejs index.js ./
COPY --chown=nodejs:nodejs lib ./lib
USER nodejs
EXPOSE ${MJML_PORT}
ENTRYPOINT ["dumb-init", "--"]
CMD ["node", "index.js"]
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=5 \
CMD node -e "require('http').get('http://127.0.0.1:${MJML_PORT}/v1/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1); }).on('error', () => process.exit(1));"