summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2021-03-25 10:20:32 +0100
committerSanto Cariotti <santo@dcariotti.me>2021-03-25 10:23:46 +0100
commitd5e2f374c07d976cd56ece3aef6819def2b00502 (patch)
treecf484b99c5df150681cbf2ebdd3743332c366ff9
parentb5cf43e435153bbb99ffa4b2637b36c9d6dbac87 (diff)
docker: add dockerfile
-rw-r--r--Dockerfile19
-rw-r--r--nginx.conf10
2 files changed, 29 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..827cde4
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,19 @@
+# build stage
+FROM node:14-alpine as build-stage
+WORKDIR /app
+COPY package*.json ./
+
+# environment variables
+ARG VUE_APP_BACKEND_URL
+
+RUN npm install --production
+COPY . .
+RUN npm run build --production
+
+# production stage
+FROM nginx:stable-alpine as production-stage
+COPY ./nginx.conf /temp/prod.conf
+RUN envsubst /app < /temp/prod.conf > /etc/nginx/conf.d/default.conf
+COPY --from=build-stage /app/dist/ /usr/share/nginx/html
+EXPOSE 80
+CMD ["nginx", "-g", "daemon off;"]
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..6cd380c
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,10 @@
+server {
+ listen 80;
+ server_name _ default_server;
+
+ root /usr/share/nginx/html;
+
+ location / {
+ try_files $uri $uri/ /index.html;
+ }
+}