Update Dockerfile for v2

This commit is contained in:
Linus Groh
2019-10-26 17:57:33 +01:00
parent 1c05bb17b4
commit 3444b75345
+21 -8
View File
@@ -1,11 +1,24 @@
FROM nginx:alpine
EXPOSE 80
FROM node:10 as build
LABEL version="2.0.0-alpha"
LABEL description="OwnTracks UI"
LABEL maintainer="Linus Groh <mail@linusgroh.de>"
WORKDIR /usr/src/app
COPY package.json yarn.lock ./
RUN yarn install
COPY . ./
RUN yarn build
FROM nginx:1.17-alpine
ENV LISTEN_PORT=80 \
SERVER_HOST=otrecorder \
SERVER_PORT=80
COPY nginx.tmpl /etc/nginx/nginx.tmpl
COPY index.html /usr/share/nginx/html
COPY static/ /usr/share/nginx/html/static/
CMD /bin/sh -c "envsubst '\${SERVER_HOST} \${SERVER_PORT} \${LISTEN_PORT}' < /etc/nginx/nginx.tmpl > /etc/nginx/nginx.conf && nginx -g 'daemon off;' || ( env; cat /etc/nginx/nginx.conf )"
COPY ./docker/nginx.tmpl /etc/nginx/nginx.tmpl
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
EXPOSE 80
CMD /bin/sh -c " \
envsubst '\${SERVER_HOST} \${SERVER_PORT} \${LISTEN_PORT}' \
< /etc/nginx/nginx.tmpl \
> /etc/nginx/nginx.conf \
&& nginx -g 'daemon off;' \
|| ( env; cat /etc/nginx/nginx.conf ) \
"