summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-09-27 15:43:32 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-09-27 15:49:11 +0200
commit27bf626f10a9f48a6cf0e24180af7c03991f66fc (patch)
treec71c257e5f3bc48ce914897074310bd9413e5f3b
parentfc516058ef59cbbb2d613347c5fce81be783f771 (diff)
Add Dockerfile
-rw-r--r--Dockerfile21
-rw-r--r--nginx.conf10
2 files changed, 31 insertions, 0 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..2400584
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,21 @@
+# build stage
+FROM node:lts-alpine as build-stage
+WORKDIR /app
+COPY package*.json ./
+
+# environment variables
+# used by Vue.js app as `process.env.<name>` into the views/components
+ARG BACKEND_URL
+
+RUN npm install
+RUN npx browserslist@latest --update-db
+COPY . .
+RUN npm run build && npm run generate
+
+# 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;
+ }
+}