From 8108360671b46b4216069c5a36be3395808b6a88 Mon Sep 17 00:00:00 2001 From: "E. Aakash" <09e.aakash@gmail.com> Date: Thu, 23 Jul 2020 13:53:21 +0530 Subject: [PATCH] feat: add dockerfile --- .dockerignore | 43 +++++++++++++++++++++++++++++++++++++++++++ dockerfile | 13 +++++++++++++ nginx.conf | 27 +++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 .dockerignore create mode 100644 dockerfile create mode 100644 nginx.conf diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..403810c --- /dev/null +++ b/.dockerignore @@ -0,0 +1,43 @@ +/dist +/tmp +/out-tsc +# Only exists if Bazel was run +/bazel-out + +# dependencies +/node_modules + +# profiling files +chrome-profiler-events.json +speed-measure-plugin.json + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +.history/* + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +yarn-error.log +testem.log +/typings + +# System Files +.DS_Store +Thumbs.db diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..290d887 --- /dev/null +++ b/dockerfile @@ -0,0 +1,13 @@ +# base image +FROM node:12.7-alpine as build +WORKDIR /app +ENV PATH /app/node_modules/.bin:$PATH +COPY package.json ./ +RUN npm install +COPY . ./ +RUN ng build --output-path /build --prod + +### STAGE 2: Run ### +FROM nginx:1.17.1-alpine +COPY nginx.conf /etc/nginx/nginx.conf +COPY --from=build /build /var/www/html diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..be2c4a2 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,27 @@ +events{} + +http { + + include /etc/nginx/mime.types; + + upstream backend { + server go-cerium:8000; + #server localhost:8000; + } + + server { + listen 80; + server_name localhost; + root /var/www/html; + + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + + location /api { + proxy_pass http://backend; + } + } +} \ No newline at end of file