Skip to content
Snippets Groups Projects
Verified Commit 9d62f10d authored by Armin Co's avatar Armin Co
Browse files

Multistage Dockerfile

One Dockerfile that contains:
base mumble-web image for building
nginx webserver with builded mumble-web page
image with websockify
parent 4fb47981
Branches
No related tags found
1 merge request!1Feature nginx.
FROM nginx:alpine
# multi stage dockerfile
# it defines three different images
# 1. mumble-web
# 2. mumble-web with nginx
# 3. websockfiy as web socket
LABEL maintainer="Armin Co <armin.co@hs-bochum.de"
# mumble-web base image
FROM alpine:edge AS mumble-web
LABEL maintainer="Armin Co <armin.co@hs-bochum.de"
# copy mumble-web repository into docker image
COPY ./mumble-web /home/node
# install deps for building mumble web
RUN apk add --no-cache \
git \
nodejs \
......@@ -15,16 +21,29 @@ RUN apk add --no-cache \
mkdir -p /home/node/.npm-global && \
mkdir -p /home/node/app && \
chown -R node: /home/node
USER node
ENV PATH=/home/node/.npm-global/bin:$PATH
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global
# "install" mumble-web
# build mumble-web
RUN cd /home/node && \
npm install && \
npm run build && \
npm audit fix && \
npm audit
# add nginx as webserver to mumble web
FROM nginx:alpine AS mumble-web-nginx
USER root
COPY --from=mumble-web /home/node/dist /home/node/dist
RUN apk add --no-cache nginx && \
adduser -D -g 'www' www && \
mkdir /data
EXPOSE 443
# websockify
FROM alpine:edge AS websockify
RUN echo http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
apk add --no-cache websockify
EXPOSE 64737
FROM build_mumble_web_image
USER root
RUN apk add --no-cache bash nginx && \
adduser -D -g 'www' www && \
mkdir /config
EXPOSE 443
COPY webserver/entrypoint.sh /
COPY webserver/ /config
RUN chmod +x /entrypoint.sh
CMD /bin/bash ./entrypoint.sh
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment