Skip to content

Commit

Permalink
Refactor container CI
Browse files Browse the repository at this point in the history
  • Loading branch information
GDYendell committed Jun 24, 2024
1 parent 6f3ee85 commit bef3b8b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 49 deletions.
65 changes: 17 additions & 48 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
contents: read
packages: write

env:
TAG: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}

steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -40,83 +43,49 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=latest
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Docker meta config developer
id: meta-developer
uses: docker/metadata-action@v4
- name: Build image
uses: docker/build-push-action@v4
with:
images: ghcr.io/${{ github.repository }}-developer
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=latest
context: .
file: Dockerfile
target: runtime
push: false
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Docker build developer image
- name: Push developer image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
target: developer
tags: ${{ env.TAG }}-developer:latest
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-build.outputs.tags }}
labels: ${{ steps.meta-build.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache


- name: Docker meta config build
id: meta-build
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}-build
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=latest
- name: Docker build build image
- name: Push build image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
target: build
tags: ${{ env.TAG }}-build:latest
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-build.outputs.tags }}
labels: ${{ steps.meta-build.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Docker meta config runtime
id: meta-runtime
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}-runtime
tags: |
type=ref,event=branch
type=ref,event=tag
type=raw,value=latest
- name: Docker build runtime image
- name: Push runtime image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
target: runtime
tags: ${{ env.TAG }}-runtime:latest
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta-runtime.outputs.tags }}
labels: ${{ steps.meta-runtime.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ RUN mkdir /odin && \
RUN python -m pip install /tmp/odin-data/python[meta_writer]

# Runtime stage ################################################################
FROM common as runtime
FROM common AS runtime

# runtime system dependencies
RUN apt-get update -y && apt-get install -y --no-install-recommends \
Expand Down

0 comments on commit bef3b8b

Please sign in to comment.