mx-puppet-xmpp/Dockerfile

67 lines
1.6 KiB
Docker
Raw Normal View History

2021-02-09 17:25:58 +00:00
FROM node:alpine AS builder
2020-03-26 20:51:40 +00:00
2021-11-12 13:07:57 +00:00
WORKDIR /opt/mx-puppet-xmpp
2020-03-26 20:51:40 +00:00
# run build process as user in case of npm pre hooks
# pre hooks are not executed while running as root
2021-11-12 13:07:57 +00:00
RUN chown node:node /opt/mx-puppet-xmpp
RUN apk update && apk --no-cache add git python3 make g++ pkgconfig \
2021-02-09 17:25:58 +00:00
build-base \
cairo-dev \
jpeg-dev \
pango-dev \
musl-dev \
giflib-dev \
pixman-dev \
pangomm-dev \
libjpeg-turbo-dev \
2021-11-12 13:07:57 +00:00
freetype-dev \
&& rm -rf /var/cache/apk/*
2021-02-09 17:25:58 +00:00
RUN wget -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
wget -O glibc-2.32-r0.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-2.32-r0.apk && \
apk add glibc-2.32-r0.apk
2020-03-26 20:51:40 +00:00
COPY package.json package-lock.json ./
2021-02-09 17:25:58 +00:00
RUN chown node:node package.json package-lock.json
USER node
2020-03-26 20:51:40 +00:00
RUN npm install
COPY tsconfig.json ./
COPY src/ ./src/
RUN npm run build
FROM node:alpine
VOLUME /data
ENV CONFIG_PATH=/data/config.yaml \
2021-11-12 13:07:57 +00:00
REGISTRATION_PATH=/data/xmpp-registration.yaml
2020-03-26 20:51:40 +00:00
# su-exec is used by docker-run.sh to drop privileges
2021-11-12 13:07:57 +00:00
RUN apk update && apk add --no-cache su-exec \
2021-02-09 17:25:58 +00:00
cairo \
jpeg \
pango \
musl \
giflib \
pixman \
pangomm \
libjpeg-turbo \
2021-11-12 13:07:57 +00:00
freetype \
&& rm -rf /var/cache/apk/*
2021-02-09 17:25:58 +00:00
2020-03-26 20:51:40 +00:00
2021-11-12 13:07:57 +00:00
WORKDIR /opt/mx-puppet-xmpp
2020-03-26 20:51:40 +00:00
COPY docker-run.sh ./
2021-11-12 13:07:57 +00:00
COPY --from=builder /opt/mx-puppet-xmpp/node_modules/ ./node_modules/
COPY --from=builder /opt/mx-puppet-xmpp/build/ ./build/
2020-03-26 20:51:40 +00:00
# change workdir to /data so relative paths in the config.yaml
# point to the persisten volume
WORKDIR /data
2021-11-12 13:07:57 +00:00
ENTRYPOINT ["/opt/mx-puppet-xmpp/docker-run.sh"]