diff --git a/.github/workflows/ghcr_publish.yml b/.github/workflows/ghcr_publish.yml index 0214fdbd..13db3db0 100644 --- a/.github/workflows/ghcr_publish.yml +++ b/.github/workflows/ghcr_publish.yml @@ -7,10 +7,10 @@ name: GHCR Publish on: push: - branches: [ "main" ] + branches: [ "main" , "dev" ] tags: [ 'v*.*.*' ] pull_request: - branches: [ "main" ] + branches: [ "main" , "dev" ] env: # Use docker.io for Docker Hub if empty @@ -32,7 +32,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Install the cosign tool except on PR # https://github.com/sigstore/cosign-installer @@ -42,15 +42,20 @@ jobs: with: cosign-release: 'v2.1.1' + # Using QEME for multiple platforms + # https://github.com/docker/build-push-action?tab=readme-ov-file#usage + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + # Workaround: https://github.com/docker/build-push-action/issues/461 - name: Setup Docker buildx - uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf + uses: docker/setup-buildx-action@v3 # Login against a Docker registry except on PR # https://github.com/docker/login-action - name: Log into registry ${{ env.REGISTRY }} if: github.event_name != 'pull_request' - uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -60,7 +65,7 @@ jobs: # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} @@ -71,8 +76,9 @@ jobs: uses: docker/build-push-action@v5 with: context: . - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.event_name != 'pull_request' && github.ref != 'refs/heads/dev' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64, linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max diff --git a/Dockerfile b/Dockerfile index 227c6be7..094c823b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,14 @@ FROM crystallang/crystal:latest-alpine As builder WORKDIR /noir COPY . . -RUN shards install -RUN shards build --release --no-debug --production +RUN shards install --production +RUN shards build --release --production --static --no-debug # RUNNER -FROM crystallang/crystal:latest-alpine As runner +FROM alpine +USER 2:2 + COPY --from=builder /noir/bin/noir /usr/local/bin/noir +COPY --from=builder /etc/ssl/cert.pem /etc/ssl/ + CMD ["noir"]