-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathContainerfile
More file actions
83 lines (64 loc) · 2.04 KB
/
Copy pathContainerfile
File metadata and controls
83 lines (64 loc) · 2.04 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
FROM docker.io/node:22-slim AS base
LABEL maintainer="Christian Koop <contact@sprax2013.de>"
LABEL org.opencontainers.image.source="https://github.com/SpraxDev/Api.Sprax2013.De"
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
openssl \
xvfb && \
apt-get clean && \
npm install --global npm --update-notifier false && \
npm cache clean --force && \
rm -Rf /root/.npm/
# TODO: Use tini/tyni
COPY <<-"EOF" /usr/local/bin/spraxapi-entrypoint.sh
#!/bin/sh
set -e
if [ "${1:-}" = "spraxapi-web" ]; then
spraxApiMode="web"
shift
elif [ "${1:-}" = "spraxapi-queue-worker" ]; then
spraxApiMode="queue-worker"
shift
elif [ "${1:-}" = "spraxapi-cli" ]; then
spraxApiMode="cli"
shift
fi
if [ "${spraxApiMode:-}" != "" ]; then
xvfb-run --auto-servernum --server-args '-ac -screen 0 1280x1024x24' node --enable-source-maps --import ./dist/sentry-init.js dist/main.js "$spraxApiMode" "$@"
exit $?
fi
exec "$@"
EOF
RUN chmod +x /usr/local/bin/spraxapi-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/spraxapi-entrypoint.sh"]
RUN mkdir /app/ && \
chown --recursive node:node /app/
WORKDIR /app/
FROM base AS builder
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y \
build-essential \
python3 \
python-is-python3
USER node
COPY --chown=node:node LICENSE README.md ./
COPY --chown=node:node package.json package-lock.json tsconfig.json ./
RUN npm clean-install
COPY --chown=node:node prisma/ prisma/
COPY --chown=node:node src/ src/
RUN npm run prisma:generate && \
npm run build
RUN npm clean-install --omit dev
FROM base AS prod
ENV NODE_ENV=production
USER node
COPY --chown=node:node LICENSE README.md ./
COPY --chown=node:node package.json package-lock.json tsconfig.json ./
COPY --chown=node:node prisma/ prisma/
COPY --chown=node:node --from=builder /app/node_modules/ node_modules/
COPY --chown=node:node resources/ resources/
COPY --chown=node:node --from=builder /app/dist/ dist/
CMD ["spraxapi-web"]