From 33d8622eb27d284dddb9bc14740e7a90b4b809d5 Mon Sep 17 00:00:00 2001 From: Philipp Dormann Date: Sun, 20 Dec 2020 18:23:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=B3=20new=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 16 +++++++++++----- docker-compose.yml | 9 ++++----- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 70c2f4b4..b20271d3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,12 @@ +FROM node:15.4.0-alpine3.12 +WORKDIR /app +RUN npm i -g pnpm +COPY package.json index.html ./ +RUN pnpm i +COPY src ./src +COPY public ./public +RUN pnpm run build +# final image FROM fholzer/nginx-brotli:v1.19.1 -ENV APP_CONF="config={}" -# TODO: buildstep -COPY ./dist /usr/share/nginx/html -COPY nginx.conf /etc/nginx/conf.d/default.conf.template -# COPY ./nginx.conf /etc/nginx/nginx.conf \ No newline at end of file +COPY --from=0 /app/dist /usr/share/nginx/html +COPY ./nginx.conf /etc/nginx/nginx.conf \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index c9178493..15d90550 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,8 @@ -version: '3' +version: "3" services: httpd: build: . - environment: - - APP_CONF=config={"baseUrl":"http://localhost:8081"} - command: ["sh", "-c", "envsubst < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"] + volumes: + - ./public/env.sample.js:/usr/share/nginx/html/env.js ports: - - 4050:80 \ No newline at end of file + - 4050:80