From 3b66780fa0faf656b825496fa08631402301fbe3 Mon Sep 17 00:00:00 2001 From: Bernd Storath <999999bst@gmail.com> Date: Mon, 9 Sep 2024 14:27:54 +0200 Subject: [PATCH] improve docker --- .dockerignore | 4 ++- .github/workflows/deploy-development.yml | 41 +++++++++++++----------- .github/workflows/deploy-nightly.yml | 41 +++++++++++++----------- .github/workflows/deploy-pr.yml | 41 +++++++++++++----------- .github/workflows/deploy.yml | 3 ++ Dockerfile | 2 ++ 6 files changed, 74 insertions(+), 58 deletions(-) diff --git a/.dockerignore b/.dockerignore index ca447caf..36a0bb06 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1 +1,3 @@ -/src/node_modules \ No newline at end of file +/src/node_modules +/src/.nuxt +/src/.output diff --git a/.github/workflows/deploy-development.yml b/.github/workflows/deploy-development.yml index 2f8f1e63..e5777bed 100644 --- a/.github/workflows/deploy-development.yml +++ b/.github/workflows/deploy-development.yml @@ -12,26 +12,29 @@ jobs: packages: write contents: read steps: - - uses: actions/checkout@v4 - with: - ref: master + - uses: actions/checkout@v4 + with: + ref: master - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build & Publish Docker Image - uses: docker/build-push-action@v6 - with: - push: true - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 - tags: ghcr.io/wg-easy/wg-easy:development + - name: Build & Publish Docker Image + uses: docker/build-push-action@v6 + with: + context: . + push: true + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 + tags: ghcr.io/wg-easy/wg-easy:development + cache-from: type=gha + cache-to: type=gha,mode=max` diff --git a/.github/workflows/deploy-nightly.yml b/.github/workflows/deploy-nightly.yml index 906d407b..3cf54fe6 100644 --- a/.github/workflows/deploy-nightly.yml +++ b/.github/workflows/deploy-nightly.yml @@ -14,26 +14,29 @@ jobs: packages: write contents: read steps: - - uses: actions/checkout@v4 - with: - ref: master + - uses: actions/checkout@v4 + with: + ref: master - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build & Publish Docker Image - uses: docker/build-push-action@v6 - with: - push: true - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 - tags: ghcr.io/wg-easy/wg-easy:nightly + - name: Build & Publish Docker Image + uses: docker/build-push-action@v6 + with: + context: . + push: true + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 + tags: ghcr.io/wg-easy/wg-easy:nightly + cache-from: type=gha + cache-to: type=gha,mode=max` diff --git a/.github/workflows/deploy-pr.yml b/.github/workflows/deploy-pr.yml index d32d818f..55a4f9aa 100644 --- a/.github/workflows/deploy-pr.yml +++ b/.github/workflows/deploy-pr.yml @@ -13,26 +13,29 @@ jobs: packages: write contents: read steps: - - uses: actions/checkout@v4 - with: - ref: master + - uses: actions/checkout@v4 + with: + ref: master - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build Docker Image - uses: docker/build-push-action@v6 - with: - push: false - platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 - tags: ghcr.io/wg-easy/wg-easy:pr + - name: Build Docker Image + uses: docker/build-push-action@v6 + with: + context: . + push: false + platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 + tags: ghcr.io/wg-easy/wg-easy:pr + cache-from: type=gha + cache-to: type=gha,mode=max` diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7374613d..91344f49 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -48,7 +48,10 @@ jobs: - name: Build & Publish Docker Image uses: docker/build-push-action@v6 with: + context: . push: true platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max` diff --git a/Dockerfile b/Dockerfile index 4a312d43..3ed1296b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,5 +43,7 @@ ENV DEBUG=Server,WireGuard,LowDB ENV PORT=51821 ENV HOST=0.0.0.0 +LABEL org.opencontainers.image.source=https://github.com/wg-easy/wg-easy + # Run Web UI CMD ["/usr/bin/dumb-init", "node", "server/index.mjs"]