diff --git a/.github/workflows/DevelopServerDeploy.yml b/.github/workflows/DevelopServerDeploy.yml index 912d67a2..e3bb6d8c 100644 --- a/.github/workflows/DevelopServerDeploy.yml +++ b/.github/workflows/DevelopServerDeploy.yml @@ -41,6 +41,18 @@ jobs: node-version: 18 cache: npm + - name: Build hugo docs + run: | + docker run \ + -v "${GITHUB_WORKSPACE}/hugo:/site" \ + -v "${GITHUB_WORKSPACE}/website:/website" \ + -v "/var/www/dev.wikigdrive.com:/dist/hugo" \ + --env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://dev.wikigdrive.com" \ + wgd-action-runner:develop /steps/step_render_hugo + + - name: Copy index for vite + run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/dev.wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo + - uses: whoan/docker-build-with-cache-action@v5 with: image_name: "wikigdrive-develop" @@ -55,15 +67,6 @@ jobs: run: docker stop wikigdrive-develop ; docker rm wikigdrive-develop continue-on-error: true - - name: Build hugo docs - run: | - docker run \ - -v "${GITHUB_WORKSPACE}/hugo:/site" \ - -v "${GITHUB_WORKSPACE}/website:/website" \ - -v "/var/www/dev.wikigdrive.com:/dist/hugo" \ - --env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://dev.wikigdrive.com" \ - wgd-action-runner:develop /steps/step_render_hugo - - name: Start run: | docker run -d --name wikigdrive-develop \ @@ -72,6 +75,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..7f5a8860 100644 --- a/.github/workflows/ProdServerDeploy.yml +++ b/.github/workflows/ProdServerDeploy.yml @@ -42,6 +42,18 @@ jobs: node-version: 18 cache: npm + - name: Build hugo docs + run: | + docker run \ + -v "${GITHUB_WORKSPACE}/hugo:/site" \ + -v "${GITHUB_WORKSPACE}/website:/website" \ + -v "/var/www/dev.wikigdrive.com:/dist/hugo" \ + --env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://wikigdrive.com" \ + wgd-action-runner:prod /steps/step_render_hugo + + - name: Copy index for vite + run: mkdir -p ${GITHUB_WORKSPACE}/dist/hugo && cp -rf /var/www/wikigdrive.com/* ${GITHUB_WORKSPACE}/dist/hugo + - uses: whoan/docker-build-with-cache-action@v5 with: image_name: "wikigdrive-prod" @@ -56,15 +68,6 @@ jobs: run: docker stop wikigdrive-prod ; docker rm wikigdrive-prod continue-on-error: true - - name: Build hugo docs - run: | - docker run \ - -v "${GITHUB_WORKSPACE}/hugo:/site" \ - -v "${GITHUB_WORKSPACE}/website:/website" \ - -v "/var/www/dev.wikigdrive.com:/dist/hugo" \ - --env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://wikigdrive.com" \ - wgd-action-runner:prod /steps/step_render_hugo - - name: Start run: | docker run -d --name wikigdrive-prod \ @@ -72,6 +75,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/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 14bfad32..00bb4f4b 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -40,6 +40,18 @@ jobs: node-version: 18 cache: npm + - name: Build hugo docs + run: | + docker run \ + -v "${GITHUB_WORKSPACE}/hugo:/site" \ + -v "${GITHUB_WORKSPACE}/website:/website" \ + -v "/var/www/test.wikigdrive.com:/dist/hugo" \ + --env CONFIG_TOML="/site/config/_default/config.toml" --env BASE_URL="https://test.wikigdrive.com" \ + wgd-action-runner:develop /steps/step_render_hugo + + - name: Copy index for vite + run: mkdir -p dist/hugo && cp -rf /var/www/test.wikigdrive.com/* dist/hugo + - name: Build run: docker build -t wikigdrive-test --build-arg "GIT_SHA=${GITHUB_SHA}" . @@ -52,4 +64,4 @@ jobs: continue-on-error: true - name: Start - run: docker run -t -v wikiGDriveExample:/data -v /home/githubactions/wikigdrive/service_account.json:/service_account.json wikigdrive-test wikigdrive --service_account /service_account.json --share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com --workdir /data pull 0AIkOKXbzWCtSUk9PVA + run: docker run -t -v wikiGDriveExample:/data -v /home/githubactions/wikigdrive/service_account.json:/service_account.json -v "/var/www/dev.wikigdrive.com:/usr/src/app/dist/hugo" wikigdrive-test wikigdrive --service_account /service_account.json --share_email mie-docs-wikigdrive@wikigdrive.iam.gserviceaccount.com --workdir /data pull 0AIkOKXbzWCtSUk9PVA diff --git a/Dockerfile b/Dockerfile index 96d4cc52..c2995954 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,9 @@ 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/hugo/themes/wgd-bootstrap/layouts/_default/baseof.html /usr/src/app/apps/ui/index.html +RUN if [[ -d /usr/src/app/dist/hugo/ui ]]; then cp /usr/src/app/dist/hugo/ui/index.html /usr/src/app/apps/ui/index.html ; fi +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 +---