Skip to content

Commit

Permalink
ci(docker): revert workflow changes
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewpi committed Feb 23, 2023
1 parent 8ae40a7 commit 0d225b0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/container.yaml → .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Container
name: Docker

on:
push:
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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
16 changes: 9 additions & 7 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 \
Expand Down

0 comments on commit 0d225b0

Please sign in to comment.