Build Docker image with GoReleaser
This commit is contained in:
parent
0001c7da60
commit
059b6b6307
|
|
@ -16,6 +16,9 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
environment: publish
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
|
|
@ -24,6 +27,13 @@ jobs:
|
|||
with:
|
||||
go-version-file: go.mod
|
||||
cache: true
|
||||
- uses: docker/setup-qemu-action@v4
|
||||
- uses: docker/setup-buildx-action@v4
|
||||
- uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
- name: Create release app token for this repo
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
|
||||
|
|
@ -81,34 +91,3 @@ jobs:
|
|||
with:
|
||||
name: orchard-snapshot
|
||||
path: dist/**
|
||||
|
||||
docker:
|
||||
name: Release Docker Image
|
||||
if: github.ref_type == 'tag'
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: docker/setup-qemu-action@v4
|
||||
- uses: docker/setup-buildx-action@v4
|
||||
- uses: docker/login-action@v4
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ github.token }}
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
ghcr.io/openai/orchard:${{ github.ref_name }}
|
||||
ghcr.io/openai/orchard:latest
|
||||
build-args: |
|
||||
VERSION=${{ github.ref_name }}
|
||||
COMMIT=${{ github.sha }}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,17 @@ notarize:
|
|||
key_id: "{{.Env.MACOS_NOTARY_KEY_ID}}"
|
||||
key: "{{.Env.MACOS_NOTARY_KEY}}"
|
||||
|
||||
dockers_v2:
|
||||
- images:
|
||||
- ghcr.io/openai/orchard
|
||||
tags:
|
||||
- "{{ .Tag }}"
|
||||
- latest
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
disable: "{{ .IsSnapshot }}"
|
||||
|
||||
brews:
|
||||
- name: orchard
|
||||
directory: Formula
|
||||
|
|
|
|||
22
Dockerfile
22
Dockerfile
|
|
@ -1,29 +1,13 @@
|
|||
FROM golang:1.25 AS builder
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
|
||||
ARG VERSION=dev
|
||||
ARG COMMIT=unknown
|
||||
|
||||
RUN CGO_ENABLED=0 go build \
|
||||
-trimpath \
|
||||
-ldflags="-X github.com/cirruslabs/orchard/internal/version.Version=${VERSION} -X github.com/cirruslabs/orchard/internal/version.Commit=${COMMIT} -B gobuildid" \
|
||||
-o /out/orchard \
|
||||
cmd/orchard/main.go
|
||||
|
||||
FROM gcr.io/distroless/base
|
||||
|
||||
ARG TARGETPLATFORM
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/openai/orchard
|
||||
ENV GIN_MODE=release
|
||||
ENV ORCHARD_HOME=/data
|
||||
EXPOSE 6120
|
||||
|
||||
COPY --from=builder /out/orchard /bin/orchard
|
||||
COPY $TARGETPLATFORM/orchard /bin/orchard
|
||||
|
||||
ENTRYPOINT ["/bin/orchard"]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue