From 1967546ae4e8b5164e50781298436e3ea33379b2 Mon Sep 17 00:00:00 2001 From: Aine Date: Tue, 3 Sep 2024 15:50:11 +0300 Subject: [PATCH] enable docker action to see how it goes --- .github/workflows/workflow.yml | 56 ++++++++++++++++------------------ Dockerfile | 27 ++-------------- README.md | 2 ++ 3 files changed, 32 insertions(+), 53 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 63f0e3d..c9c2642 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -4,7 +4,7 @@ on: branches: [ "main" ] env: upstream_version: v0.10.3 - etke_version: etke6 + etke_version: etke7 bunny_version: v0.1.0 base_path: ./ permissions: @@ -46,34 +46,32 @@ jobs: with: name: dist-${{ env.upstream_version }}-${{ env.etke_version }} path: dist/ - - name: Debug - run: ls -lah dist/ - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v1 - # - name: Login to ghcr.io - # uses: docker/login-action@v3 - # with: - # registry: ghcr.io - # username: ${{ github.actor }} - # password: ${{ secrets.GITHUB_TOKEN }} - # - name: Extract metadata (tags, labels) for Docker - # id: meta - # uses: docker/metadata-action@v5 - # with: - # images: | - # ghcr.io/${{ github.repository }} - # registry.etke.cc/${{ github.repository }} - # tags: | - # type=raw,value=latest,enable=${{ github.ref_name == 'main' }} - # type=raw,value=${{ env.upstream_version }}-${{ env.etke_version }},enable=${{ github.ref_name == 'main' }} - # - name: Build and push - # uses: docker/build-push-action@v6 - # with: - # platforms: linux/amd64,linux/arm64 - # context: . - # push: true - # tags: ${{ steps.meta.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository }} + registry.etke.cc/${{ github.repository }} + tags: | + type=raw,value=latest,enable=${{ github.ref_name == 'main' }} + type=raw,value=${{ env.upstream_version }}-${{ env.etke_version }},enable=${{ github.ref_name == 'main' }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} # # build-deploy: # name: Build and Release diff --git a/Dockerfile b/Dockerfile index 7744941..36eeea7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,26 +1,5 @@ -# Builder -FROM node:lts as builder -LABEL org.opencontainers.image.url=https://github.com/etkecc/synapse-admin org.opencontainers.image.source=https://github.com/etkecc/synapse-admin -# Base path for synapse admin -ARG BASE_PATH=./ +FROM ghcr.io/static-web-server/static-web-server:2 -WORKDIR /src +ENV SERVER_ROOT=/app -# Copy .yarn directory to the working directory (must be on a separate line!) -# Use https://docs.docker.com/engine/reference/builder/#copy---parents when available -COPY .yarn .yarn -COPY package.json .yarnrc.yml yarn.lock ./ - -# Disable telemetry and install packages -RUN yarn config set enableTelemetry 0 && yarn install --immutable --network-timeout=300000 - -COPY . /src -RUN yarn build --base=$BASE_PATH - -# App -FROM nginx:stable-alpine - -COPY --from=builder /src/dist /app - -RUN rm -rf /usr/share/nginx/html \ - && ln -s /app /usr/share/nginx/html +COPY ./dist /app diff --git a/README.md b/README.md index 1aacb7f..7ac29db 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ The following changes are already implemented: * [Add ability to toggle whether to show locked users](https://github.com/Awesome-Technologies/synapse-admin/pull/573) * [Fix user's display name in header on user's page](https://github.com/etkecc/synapse-admin/pull/9) * [Fix footer overlapping content](https://github.com/Awesome-Technologies/synapse-admin/issues/574) +* Switch from nginx to [SWS](https://static-web-server.net/) for serving the app, reducing the size of the Docker image +by 340% _the list will be updated as new changes are added_