add Dockerfile + nginx

This commit is contained in:
Gumelar Agum 2019-10-31 13:37:38 +07:00
parent 4abf62f310
commit a2c4171fc2
2 changed files with 27 additions and 0 deletions

17
Dockerfile Normal file
View file

@ -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/

10
nginx/default.conf Normal file
View file

@ -0,0 +1,10 @@
server {
listen 80;
server_name localhost;
root /app/dashboard/;
location / {
index index.html;
try_files $uri $uri/ /index.html$args;
}
}