Skip to content

Commit

Permalink
Maybe build image with useful tags
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvolp12 committed Sep 10, 2024
1 parent b6a750b commit 04fbd4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Docker image

on:
push:
branches: ['main']
branches: ["main"]

env:
REGISTRY: ghcr.io
Expand All @@ -17,7 +17,7 @@ jobs:
packages: write
attestations: write
id-token: write
#
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -34,6 +34,9 @@ jobs:
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=sha
type=sha,format=long
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
Expand All @@ -45,12 +48,11 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."

# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)."
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
GO_CMD_W_CGO = CGO_ENABLED=1 GOOS=linux go
GO_CMD = CGO_ENABLED=0 GOOS=linux go
JETSTREAM_VERSION = $(shell git rev-parse HEAD)

# Build Jetstream
.PHONY: build
Expand All @@ -16,12 +17,12 @@ run: .env
.PHONY: up
up:
@echo "Starting Jetstream..."
docker compose up -d
JETSTREAM_VERSION=${JETSTREAM_VERSION} docker compose up -d

.PHONY: rebuild
rebuild:
@echo "Starting Jetstream..."
docker compose up -d --build
JETSTREAM_VERSION=${JETSTREAM_VERSION} docker compose up -d --build

.PHONY: down
down:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
jetstream:
image: ghcr.io/ericvolp12/jetstream:main
image: ghcr.io/ericvolp12/jetstream:${JETSTREAM_VERSION}
build:
context: .
dockerfile: Dockerfile
Expand Down

0 comments on commit 04fbd4f

Please sign in to comment.