diff --git a/.dockerignore b/.dockerignore index bdb195d34..70ddd36fa 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,6 @@ **/.classpath **/.dockerignore -**/.env +**/.env* **/.git **/.gitignore **/.project @@ -27,4 +27,12 @@ LICENSE README.md PhotonPlugin/ **/*.Test/ -**/logs \ No newline at end of file +**/logs +**/.pnpm-store +**/build +**/mockServiceWorker.js +**/test-results +**/tests +**/dist +!Website/.env +!Website/.env.production \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f8113bc39..dfd339290 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -39,13 +39,13 @@ jobs: TAG_REGEX="[\w]+?@v(.*)" echo "Ref: ${{ inputs.ref }}" echo "Tag: ${{ inputs.image-tag }}" - + if [ ${{ inputs.image-tag }} != "undefined" ] then echo "tag=${{ inputs.image-tag }}" >> "$GITHUB_OUTPUT" exit 0; fi - + if [ ${{ inputs.ref }} = "main" ] then echo "tag=latest" >> "$GITHUB_OUTPUT" @@ -56,22 +56,17 @@ jobs: echo "No image-tag provided and failed to derive image tag from ref" exit 1; fi - + - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} - + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - + - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin - - - name: Setup .NET Core SDK - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x - + - name: Build and push uses: docker/build-push-action@v6 with: @@ -80,4 +75,4 @@ jobs: file: ${{ inputs.dockerfile }} tags: ghcr.io/sapiensanatis/${{ inputs.image-name }}:${{ steps.derive-tag.outputs.tag }} cache-from: type=gha - cache-to: type=gha,mode=max + cache-to: type=gha,mode=max diff --git a/.github/workflows/publish-website.yaml b/.github/workflows/publish-website.yaml new file mode 100644 index 000000000..c91aeb509 --- /dev/null +++ b/.github/workflows/publish-website.yaml @@ -0,0 +1,18 @@ +name: Publish website + +on: + push: + branches: + - main + paths: + - Website/** + +jobs: + build: + name: Build + uses: ./.github/workflows/build.yaml + with: + ref: main + dockerfile: "Website/Dockerfile" + image-name: "dawnshard-website" + secrets: inherit diff --git a/Website/Dockerfile b/Website/Dockerfile new file mode 100644 index 000000000..a6eb979be --- /dev/null +++ b/Website/Dockerfile @@ -0,0 +1,31 @@ +FROM node:22.3.0-bookworm-slim AS base + +EXPOSE 3000 + +ENV NPM_CONFIG_PREFIX=/home/node/.npm-global +ENV PATH=$PATH:/home/node/.npm-global/bin +RUN npm install -g pnpm + +ENV PNPM_HOME="/pnpm" +ENV PATH="$PNPM_HOME:$PATH" + +WORKDIR /app +COPY ["Website/package.json", "Website/pnpm-lock.yaml", "./"] + +FROM base AS prod-deps +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile + +FROM base AS build +RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile +COPY ["Website/", "./"] +RUN echo "PUBLIC_ENABLE_MSW=false" >> ./.env.production +RUN pnpm run build + +FROM base +COPY --from=prod-deps ["/app/node_modules", "./node_modules"] +COPY --from=build ["/app/build", "./"] + +ENV NODE_ENV="production" + +USER node +CMD ["node", "./index.js"] diff --git a/Website/src/app.html b/Website/src/app.html index 9a27b47d2..a0178a52f 100644 --- a/Website/src/app.html +++ b/Website/src/app.html @@ -2,7 +2,7 @@ - + Dawnshard %sveltekit.head% diff --git a/Website/static/favicon.ico b/Website/static/favicon.ico new file mode 100644 index 000000000..9d26d95c0 Binary files /dev/null and b/Website/static/favicon.ico differ diff --git a/Website/static/favicon.png b/Website/static/favicon.png deleted file mode 100644 index 825b9e65a..000000000 Binary files a/Website/static/favicon.png and /dev/null differ