diff --git a/docker/Dockerfile b/docker/Dockerfile index 50889c6..628a62c 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 " +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 ) \ + "