From 0d225b0e8f9008d7f4a82a65d3fdc22887cbbd79 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Thu, 23 Feb 2023 14:35:07 -0700 Subject: [PATCH] ci(docker): revert workflow changes --- .../workflows/{container.yaml => docker.yaml} | 33 +++++++++---------- Containerfile | 16 +++++---- 2 files changed, 25 insertions(+), 24 deletions(-) rename .github/workflows/{container.yaml => docker.yaml} (71%) diff --git a/.github/workflows/container.yaml b/.github/workflows/docker.yaml similarity index 71% rename from .github/workflows/container.yaml rename to .github/workflows/docker.yaml index 4a7bd26b0..5e70015ee 100644 --- a/.github/workflows/container.yaml +++ b/.github/workflows/docker.yaml @@ -1,4 +1,4 @@ -name: Container +name: Docker on: push: @@ -14,8 +14,8 @@ on: - published jobs: - build-and-push: - name: Build and Push + push: + name: Push runs-on: ubuntu-22.04 steps: - name: Code checkout @@ -33,8 +33,14 @@ jobs: type=ref,event=tag type=ref,event=branch + - name: Setup QEMU + uses: docker/setup-qemu-action@v2 + + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry - uses: redhat-actions/podman-login@v1 + uses: docker/login-action@v2 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -47,21 +53,14 @@ jobs: run: | sed -i "s/ 'version' => 'canary',/ 'version' => '${REF:1}',/" config/app.php - - name: Build - id: build - uses: redhat-actions/buildah-build@v2 + - name: Build and Push + uses: docker/build-push-action@v3 with: context: . - containerfiles: ./Containerfile + file: ./Containerfile + push: ${{ github.event_name != 'pull_request' }} platforms: linux/amd64,linux/arm64 labels: ${{ steps.metadata.outputs.labels }} tags: ${{ steps.metadata.outputs.tags }} - oci: true - - - name: Push to GitHub Container Registry - uses: redhat-actions/push-to-registry@v2 - if: "github.event_name != 'pull_request'" - with: - image: ${{ steps.build.outputs.image }} - tags: ${{ steps.build.outputs.tags }} - registry: ghcr.io + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/Containerfile b/Containerfile index 219af947b..bc922b22e 100644 --- a/Containerfile +++ b/Containerfile @@ -1,18 +1,20 @@ # Stage 1 - Builder -FROM registry.access.redhat.com/ubi9/nodejs-18-minimal AS builder +FROM --platform=$TARGETOS/$TARGETARCH registry.access.redhat.com/ubi9/nodejs-18-minimal AS builder USER 0 -RUN npm install -g yarn +RUN npm install -g pnpm WORKDIR /var/www/pterodactyl COPY --chown=1001:0 public ./public COPY --chown=1001:0 resources/scripts ./resources/scripts -COPY --chown=1001:0 .eslintignore .eslintrc.js .prettierrc.json package.json tailwind.config.js tsconfig.json vite.config.ts yarn.lock . +COPY --chown=1001:0 .eslintignore .eslintrc.js .npmrc .prettierrc.json package.json pnpm-lock.yaml tailwind.config.js tsconfig.json vite.config.ts . -RUN /opt/app-root/src/.npm-global/bin/yarn install --frozen-lockfile \ - && /opt/app-root/src/.npm-global/bin/yarn build \ - && rm -rf resources/scripts .eslintignore .eslintrc.yml .yarnrc.yml package.json tailwind.config.js tsconfig.json vite.config.ts yarn.lock node_modules +RUN /opt/app-root/src/.npm-global/bin/pnpm install \ + && /opt/app-root/src/.npm-global/bin/pnpm build \ + && rm -rf resources/scripts .eslintignore .eslintrc.yml .npmrc package.json pnpm-lock.yaml tailwind.config.js tsconfig.json vite.config.ts node_modules + +USER 1001 COPY --chown=1001:0 app ./app COPY --chown=1001:0 bootstrap ./bootstrap @@ -25,7 +27,7 @@ COPY --chown=1001:0 .env.example ./.env COPY --chown=1001:0 artisan CHANGELOG.md composer.json composer.lock LICENSE.md README.md SECURITY.md . # Stage 2 - Final -FROM registry.access.redhat.com/ubi9/ubi-minimal +FROM --platform=$TARGETOS/$TARGETARCH registry.access.redhat.com/ubi9/ubi-minimal RUN microdnf update -y \ && rpm --install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm \