From a8e66bf29ee122428fa9a53d2e13562509f0620c Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Mon, 26 Jun 2023 14:44:11 +0200 Subject: [PATCH 1/5] build: add first draft for Docker --- Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..13ea272 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM node:lts-alpine as build-stage + +# make the 'app' folder the current working directory +WORKDIR /app + +# copy both 'package.json' and 'package-lock.json' (if available) +COPY package*.json ./ + +# install project dependencies +RUN npm install + +# copy project files and folders to the current working directory (i.e. 'app' folder) +COPY . . +RUN npm run build + +# production stage +FROM nginx:stable-alpine as production-stage +COPY --from=build-stage /app/dist /usr/share/nginx/html +EXPOSE 8093 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file From 9ddbfc30492ac1169623daeb6559a3a219e2a547 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 27 Jun 2023 09:01:48 +0200 Subject: [PATCH 2/5] build: finalize Dockerfile --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 13ea272..94048bd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,5 +16,3 @@ RUN npm run build # production stage FROM nginx:stable-alpine as production-stage COPY --from=build-stage /app/dist /usr/share/nginx/html -EXPOSE 8093 -CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file From 189cf282c7d389a96ad54b9a3cc54cd0209758f5 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 27 Jun 2023 09:02:05 +0200 Subject: [PATCH 3/5] fix: adjust baseURL to Docker setup --- vite.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.js b/vite.config.js index 009ea17..bdf2fb1 100644 --- a/vite.config.js +++ b/vite.config.js @@ -7,7 +7,7 @@ import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'; // https://vitejs.dev/config/ export default defineConfig({ - base: '/quiver-frontend/', + base: '/', build: { outDir: 'dist', }, From d68afc7d9d25632c11d54f9af36221b7d63a4ef3 Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Tue, 27 Jun 2023 09:04:09 +0200 Subject: [PATCH 4/5] docs: update README --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 885e5ac..4c648ee 100644 --- a/README.md +++ b/README.md @@ -29,3 +29,17 @@ npm run build ```sh npm run lint ``` + +## Project Setup with Docker + +Build the Docker image: + +```sh +docker build -t qfa . +``` + +Run a container based on this image: + +```sh +docker run --rm -d --name qfa-server -p 8083:80 qfa +``` From 92a99f89ed81ebc541ca655330cfaa9940de7ebf Mon Sep 17 00:00:00 2001 From: Michelle Weidling Date: Wed, 28 Jun 2023 09:26:12 +0200 Subject: [PATCH 5/5] fix: restore old baseURL --- Dockerfile | 3 ++- vite.config.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94048bd..2781d50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,4 +15,5 @@ RUN npm run build # production stage FROM nginx:stable-alpine as production-stage -COPY --from=build-stage /app/dist /usr/share/nginx/html +COPY --from=build-stage /app/dist/assets /usr/share/nginx/html/quiver-frontend/assets +COPY --from=build-stage /app/dist/index.html /usr/share/nginx/html/index.html diff --git a/vite.config.js b/vite.config.js index bdf2fb1..009ea17 100644 --- a/vite.config.js +++ b/vite.config.js @@ -7,7 +7,7 @@ import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite'; // https://vitejs.dev/config/ export default defineConfig({ - base: '/', + base: '/quiver-frontend/', build: { outDir: 'dist', },