diff --git a/.github/workflows/docker_release.yaml b/.github/workflows/docker_release.yaml new file mode 100644 index 0000000..058f1cd --- /dev/null +++ b/.github/workflows/docker_release.yaml @@ -0,0 +1,37 @@ +name: Build and Publish Asterisc Images + +on: [workflow_dispatch, workflow_call] + +env: + REGISTRY: ghcr.io + +jobs: + build-asterisc-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + env: + IMAGE_NAME: ${{ github.repository }}/asterisc + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Authenticate with container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and Publish `asterisc` + uses: docker/build-push-action@v6 + with: + file: Dockerfile.release + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile.release b/Dockerfile.release new file mode 100644 index 0000000..00cff11 --- /dev/null +++ b/Dockerfile.release @@ -0,0 +1,20 @@ +FROM golang:1.21.1-alpine3.18 AS builder +WORKDIR /build +ARG ASTERISC_TAG + +# Copy the context into the container +ADD . . + +# Install deps +RUN apk add --no-cache git make bash + +# Clone and build Asterisc @ `ASTERISC_TAG` +RUN make && \ + cp rvgo/bin/asterisc /asterisc-bin + +FROM alpine:3.18 AS export + +RUN apk add --no-cache bash +SHELL ["/bin/bash", "-c"] + +COPY --from=builder /asterisc-bin /asterisc-bin