From a2c4171fc274b09ebc28dbe8eb34a3920f386162 Mon Sep 17 00:00:00 2001 From: Gumelar Agum Date: Thu, 31 Oct 2019 13:37:38 +0700 Subject: [PATCH] add Dockerfile + nginx --- Dockerfile | 17 +++++++++++++++++ nginx/default.conf | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 Dockerfile create mode 100644 nginx/default.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..64c797ce6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,17 @@ +FROM node:10 as builder +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +ARG APP_MOUNT_URI +ARG API_URI +ARG STATIC_URL +ENV API_URI ${API_URI:-http://localhost:8000/graphql/} +ENV APP_MOUNT_URI ${APP_MOUNT_URI:-/dashboard/} +ENV STATIC_URL ${STATIC_URL:-/dashboard/} +RUN STATIC_URL=${STATIC_URL} API_URI=${API_URI} APP_MOUNT_URI=${APP_MOUNT_URI} npm run build + +FROM nginx:stable +WORKDIR /app +COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf +COPY --from=builder /app/build/ /app/ diff --git a/nginx/default.conf b/nginx/default.conf new file mode 100644 index 000000000..c5c2028ec --- /dev/null +++ b/nginx/default.conf @@ -0,0 +1,10 @@ +server { + listen 80; + server_name localhost; + root /app/dashboard/; + + location / { + index index.html; + try_files $uri $uri/ /index.html$args; + } +} \ No newline at end of file