Skip to content

Commit

Permalink
Rewrite workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
xepozz committed Sep 1, 2024
1 parent 896dd6f commit c88efc1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
42 changes: 18 additions & 24 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_IMAGE }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -79,22 +70,31 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
load: true
push: false
target: builder
file: ./Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: VITE_BUILD_ID="Github Actions"
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.tags.labels }}
outputs: type=docker,dest=/tmp/docker-builder.tar

- name: Share builder image
- name: Create container from image
run: docker create --name extract-container ${{ env.REGISTRY_IMAGE }}:latest

- name: Copy files from container
run: docker cp extract-container:/app/packages/yii-dev-panel/dist /tmp/dist

- name: List extracted files
run: ls -la /tmp/dist

- name: Clean up
run: docker rm extract-container

- name: Share JS build
uses: actions/upload-artifact@v4
with:
name: docker-builder
path: /tmp/docker-builder.tar
name: js-build
path: /tmp/dist
if-no-files-found: error
retention-days: 1

Expand All @@ -116,14 +116,9 @@ jobs:
- name: Download builder image
uses: actions/download-artifact@v4
with:
name: docker-builder
name: js-build
path: /tmp

- name: Load image
run: |
docker load --input /tmp/docker-builder.tar
docker image ls -a
- name: Get Previous tag
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
Expand All @@ -139,8 +134,7 @@ jobs:
with:
push: true
context: .
target: target
file: ./Dockerfile
file: ./Github.Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
Expand Down
10 changes: 10 additions & 0 deletions Github.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM nginx:alpine

LABEL org.opencontainers.image.source=https://github.com/yiisoft/yii-dev-panel
LABEL org.opencontainers.image.description="Yii Dev Panel"
LABEL org.opencontainers.image.licenses=BSD-3-Clause

RUN rm -rf /usr/share/nginx/html/*
COPY /tmp/dist /usr/share/nginx/html

ENTRYPOINT ["nginx", "-g", "daemon off;"]

0 comments on commit c88efc1

Please sign in to comment.