forked from soketi/soketi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.distroless
45 lines (33 loc) · 1.3 KB
/
Dockerfile.distroless
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
ARG VERSION=16
FROM --platform=$BUILDPLATFORM node:$VERSION-alpine as base
ENV PYTHONUNBUFFERED=1
COPY . /tmp/build
WORKDIR /tmp/build
RUN apk add --no-cache --update git python3 gcompat ; \
apk add --virtual build-dependencies build-base gcc wget ; \
ln -sf python3 /usr/bin/python ; \
python3 -m ensurepip ; \
pip3 install --no-cache --upgrade pip setuptools ; \
npm ci ; \
npm run build ; \
npm ci --omit=dev --ignore-scripts ; \
npm prune --production ; \
rm -rf node_modules/*/test/ node_modules/*/tests/ ; \
npm install -g modclean ; \
modclean -n default:safe --run ; \
mkdir -p /app ; \
cp -r bin/ dist/ node_modules/ LICENSE package.json package-lock.json README.md /app/ ; \
chgrp -R 0 /app/ ; \
chmod -R g+rx /app/
FROM --platform=$TARGETPLATFORM gcr.io/distroless/nodejs:$VERSION
LABEL org.opencontainers.image.authors="Soketi <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/soketi/soketi"
LABEL org.opencontainers.image.url="https://soketi.app"
LABEL org.opencontainers.image.documentation="https://docs.soketi.app"
LABEL org.opencontainers.image.vendor="Soketi"
LABEL org.opencontainers.image.licenses="AGPL-3.0"
COPY --from=base /app /app
WORKDIR /app
USER 65534
EXPOSE 6001
CMD ["/app/bin/server.js", "start"]