Skip to content

Commit

Permalink
ci: use custom action for multi stage build and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
nain-F49FF806 committed Feb 17, 2024
1 parent 0fb9f2f commit 18b369e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 102 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/docker-publish.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/multistage-docker-build-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Multi stage build and publish

on:
push:
branches:
- main
workflow_dispatch:

env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository }}

jobs:
build-and-publish:
name: Build and publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2

# This step MUST be performed before multistage-docker-build
- name: Auth to GH registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: lowercase IMAGE_REGISTRY
run: |
echo "IMAGE_REGISTRY=${IMAGE_REGISTRY@L}" >> ${GITHUB_ENV}
- uses: firehed/multistage-docker-build-action@v1
id: build
with:
context: ./rusty-fedora.container
dockerfile: rusty-fedora.container/Containerfile
repository: ${{ env.IMAGE_REGISTRY }}
stages: builder
server-stage: fedora-oxidized.toolbox

8 changes: 4 additions & 4 deletions rusty-fedora.container/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ RUN cargo install $(cat useful-crates)
RUN rm /useful-crates


FROM quay.io/toolbx-images/fedora-toolbox:39
FROM quay.io/toolbx-images/fedora-toolbox:39 as fedora-oxidized.toolbox

ARG NAME=rusty-fedora.toolbx
ARG NAME=fedora-oxidized.toolbox
ARG VERSION=39
LABEL com.github.containers.toolbox="true" \
com.redhat.component="$NAME" \
name="$NAME" \
version="$VERSION" \
usage="This image is meant to be used with the toolbx or distrobox command" \
summary="Rusted image based on Fedora Toolbx base container" \
maintainer="nain <no-reply@you-are-on-your-own.alt>"
summary="Rusted image based on Fedora Toolbox base container" \
maintainer="nain <no-reply@you-are-on-your-own-for-now.alt>"

RUN mkdir -p /opt/cargo/bin
COPY --from=builder /usr/local/cargo/bin/* /opt/cargo/bin/
Expand Down

0 comments on commit 18b369e

Please sign in to comment.