From c09ee2403840bd236e27e6e0fd8e7b7a1641cdb1 Mon Sep 17 00:00:00 2001 From: bedaberner <49646807+bedaberner@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:20:08 +0200 Subject: [PATCH 1/2] Create docker-publish.yml --- .github/workflows/docker-publish.yml | 58 ++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 00000000..1930dc3d --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,58 @@ +name: Build and Publish Docker Image + +on: + push: + branches: [ "main", "master" ] + tags: [ 'v*' ] + pull_request: + branches: [ "main", "master" ] + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: true + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=ref,event=branch + type=ref,event=pr + type=sha + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max From 71fe715f942beb4aa45c1256dfcdb93697f24ef7 Mon Sep 17 00:00:00 2001 From: bedaberner <49646807+bedaberner@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:24:27 +0200 Subject: [PATCH 2/2] Update Dockerfile --- Dockerfile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index b5ec600a..fcb8b1c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,28 @@ -FROM node:12 +FROM node:20 # Create app directory WORKDIR /usr/src/app -# Install app dependencies -# A wildcard is used to ensure both package.json AND package-lock.json are copied -# where available (npm@5+) +# Install git (needed for submodules) +RUN apt-get update && apt-get install -y git + +# Copy package files first for better caching COPY package*.json ./ +# Install dependencies RUN npm install # Bundle app source COPY . . +# Initialize and update git submodules +RUN git init +RUN git config --global url."https://github.com/".insteadOf git@github.com: +RUN git submodule init +RUN git submodule update + +# Run the update-browserslist-db as suggested in the warning +RUN npx update-browserslist-db@latest + EXPOSE 8080 -CMD [ "npm", "run", "dev" ] \ No newline at end of file +CMD [ "npm", "run", "dev" ]