From 9325e17ae339c051831632647953dc13996feebf Mon Sep 17 00:00:00 2001 From: Grzegorz Godlewski Date: Sun, 22 Oct 2023 19:23:49 +0200 Subject: [PATCH] Fix nginx and docker config --- .github/workflows/DevelopServerDeploy.yml | 1 + .github/workflows/ProdServerDeploy.yml | 1 + Dockerfile | 3 ++- src/containers/server/static.ts | 2 +- website/ui.md | 3 +++ 5 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 website/ui.md diff --git a/.github/workflows/DevelopServerDeploy.yml b/.github/workflows/DevelopServerDeploy.yml index 912d67a2..bb436c61 100644 --- a/.github/workflows/DevelopServerDeploy.yml +++ b/.github/workflows/DevelopServerDeploy.yml @@ -72,6 +72,7 @@ jobs: -v /home/githubactions/wikigdrive/service_account.json:/service_account.json \ -v /home/githubactions/wikigdrive/env.develop:/usr/src/app/.env \ -v /var/run/docker.sock:/var/run/docker.sock \ + -v "/var/www/dev.wikigdrive.com:/usr/src/app/dist/hugo" \ -e "GIT_SHA=${GITHUB_SHA}" \ -e "ZIPKIN_URL=https://dev.wikigdrive.com/zipkin" \ -e "ZIPKIN_SERVICE=wikigdrive-develop" \ diff --git a/.github/workflows/ProdServerDeploy.yml b/.github/workflows/ProdServerDeploy.yml index 0343054a..d993bc21 100644 --- a/.github/workflows/ProdServerDeploy.yml +++ b/.github/workflows/ProdServerDeploy.yml @@ -72,6 +72,7 @@ jobs: -v /home/githubactions/wikigdrive/service_account.json:/service_account.json \ -v /home/githubactions/wikigdrive/env.prod:/usr/src/app/.env \ -v /var/run/docker.sock:/var/run/docker.sock \ + -v "/var/www/wikigdrive.com:/usr/src/app/dist/hugo" \ -e "GIT_SHA=${GITHUB_SHA}" \ --publish 127.0.0.1:3000:3000 \ --restart unless-stopped \ diff --git a/Dockerfile b/Dockerfile index 96d4cc52..c423823f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,8 @@ RUN npm link --location=user EXPOSE 3000 VOLUME /data -RUN cd /usr/src/app/apps/ui && cp ../../hugo/themes/wgd-bootstrap/layouts/_default/baseof.html index.html && npm install && npm run build +RUN cp /usr/src/app/dist/hugo/ui/index.html index.html || cp /usr/src/app/hugo/themes/wgd-bootstrap/layouts/_default/baseof.html index.html +RUN cd /usr/src/app/apps/ui && npm install && npm run build WORKDIR "/usr/src/app" diff --git a/src/containers/server/static.ts b/src/containers/server/static.ts index 9ccb45ad..db948bda 100644 --- a/src/containers/server/static.ts +++ b/src/containers/server/static.ts @@ -10,7 +10,7 @@ const MAIN_DIR = __dirname + '/../../..'; export async function handleStaticHtml(app: express.Application, reqPath: string, url: string) { const hugoPath = path.resolve(MAIN_DIR, 'dist', 'hugo', (reqPath.substring(1) || 'index.html')); - const generatedHtmlPath = path.resolve(MAIN_DIR, 'dist', 'hugo', 'index.html'); + const generatedHtmlPath = path.resolve(MAIN_DIR, 'dist', 'hugo', 'ui', 'index.html'); const distPath = path.resolve(HTML_DIR, 'dist'); const baseHtmlPath = path.resolve(MAIN_DIR, 'hugo', 'themes', 'wgd-bootstrap', 'layouts', '_default', 'baseof.html'); diff --git a/website/ui.md b/website/ui.md new file mode 100644 index 00000000..e8b5405e --- /dev/null +++ b/website/ui.md @@ -0,0 +1,3 @@ +--- +# ui/index.html +---