From c8ef6f6d91c3c470804b416e7f7871e1707d46cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Du=CC=88rrwald?= Date: Sat, 8 Jun 2024 08:39:56 +0200 Subject: [PATCH] Add publish workflow --- Dockerfile | 7 ++++++ public/.gitea/workflows/publish.yml | 33 +++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 public/.gitea/workflows/publish.yml diff --git a/Dockerfile b/Dockerfile index 1d3a58a..b001f1d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,6 +52,13 @@ COPY --from=builder /app/public ./public RUN mkdir .next RUN chown nextjs:nodejs .next +# Automatically leverage output traces to reduce image size +# https://nextjs.org/docs/advanced-features/output-file-tracing +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + EXPOSE 3000 ENV PORT 3000 diff --git a/public/.gitea/workflows/publish.yml b/public/.gitea/workflows/publish.yml new file mode 100644 index 0000000..988e3d5 --- /dev/null +++ b/public/.gitea/workflows/publish.yml @@ -0,0 +1,33 @@ +name: Docker Build & Publish + +on: + push: + branches: [main] + +jobs: + build: + name: Build Docker + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx 🚀 + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub 🚢 + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build and push 🏗️ + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + push: false + # tags: | + # ${{ secrets.DOCKER_HUB_USERNAME}}/{docker_repository}:${{ github.sha }} + # ${{ secrets.DOCKER_HUB_USERNAME}}/{docker_repository}:latest \ No newline at end of file