-
Notifications
You must be signed in to change notification settings - Fork 468
feat(github-action): build and publish container images #562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
8963caf
c6c3c86
3f5a7df
da7a4da
edc1a8f
ae17724
ca0e960
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| name: Publish Kraken Images | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| tags: | ||
| - '*' | ||
knechtionscoding marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| build-and-push: | ||
| runs-on: ubuntu-22.04 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - component: kraken-agent | ||
| dockerfile: docker/agent/Dockerfile | ||
| - component: kraken-build-index | ||
| dockerfile: docker/build-index/Dockerfile | ||
| - component: kraken-origin | ||
| dockerfile: docker/origin/Dockerfile | ||
| - component: kraken-proxy | ||
| dockerfile: docker/proxy/Dockerfile | ||
| - component: kraken-testfs | ||
| dockerfile: docker/testfs/Dockerfile | ||
| - component: kraken-tracker | ||
| dockerfile: docker/tracker/Dockerfile | ||
| - component: kraken-herd | ||
| dockerfile: docker/herd/Dockerfile | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
| with: | ||
| platforms: amd64,arm64 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ghcr.io | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Generate image metadata (${{ matrix.component }}) | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ghcr.io/${{ github.repository_owner }}/${{ matrix.component }} | ||
| tags: | | ||
|
Comment on lines
+56
to
+57
|
||
| type=ref,event=tag | ||
| type=ref,event=branch | ||
| type=sha,format=short | ||
knechtionscoding marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - name: Build and push ${{ matrix.component }} | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ${{ matrix.dockerfile }} | ||
| push: true | ||
| platforms: linux/amd64,linux/arm64 | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,22 @@ | ||
| FROM golang:1.23.11 AS builder | ||
|
|
||
| ARG TARGETOS=linux | ||
| ARG TARGETARCH=amd64 | ||
| ENV CGO_ENABLED=1 GO111MODULE=on | ||
knechtionscoding marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| WORKDIR /src | ||
|
|
||
| RUN apt-get update && \ | ||
| apt-get install -y --no-install-recommends build-essential pkg-config sqlite3 libsqlite3-dev && \ | ||
knechtionscoding marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY go.mod go.sum ./ | ||
| RUN go mod download | ||
|
|
||
| COPY . . | ||
| RUN mkdir -p /out && \ | ||
| GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -buildvcs=false -o /out/kraken-agent ./agent | ||
|
|
||
| FROM debian:12 | ||
|
Comment on lines
+3
to
21
|
||
|
|
||
| RUN echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until && \ | ||
|
|
@@ -32,7 +51,7 @@ RUN if [ ${USERID} != "0" ]; then useradd --uid ${USERID} ${USERNAME}; fi | |
| COPY ./docker/setup_nginx.sh /tmp/setup_nginx.sh | ||
| RUN /tmp/setup_nginx.sh ${USERNAME} | ||
|
|
||
| COPY ./agent/agent /usr/bin/kraken-agent | ||
| COPY --from=builder /out/kraken-agent /usr/bin/kraken-agent | ||
| COPY ./config /etc/kraken/config | ||
| COPY ./nginx/config /etc/kraken/nginx/config | ||
| COPY ./test/tls /etc/kraken/tls | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,3 +1,22 @@ | ||||||||||||||||||||||||
| FROM golang:1.23.11 AS builder | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| ARG TARGETOS=linux | ||||||||||||||||||||||||
| ARG TARGETARCH=amd64 | ||||||||||||||||||||||||
| ENV CGO_ENABLED=1 GO111MODULE=on | ||||||||||||||||||||||||
knechtionscoding marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| WORKDIR /src | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| RUN apt-get update && \ | ||||||||||||||||||||||||
| apt-get install -y --no-install-recommends build-essential pkg-config sqlite3 libsqlite3-dev && \ | ||||||||||||||||||||||||
knechtionscoding marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||
| rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| COPY go.mod go.sum ./ | ||||||||||||||||||||||||
| RUN go mod download | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| COPY . . | ||||||||||||||||||||||||
| RUN mkdir -p /out && \ | ||||||||||||||||||||||||
|
Comment on lines
+15
to
+18
|
||||||||||||||||||||||||
| RUN go mod download | |
| COPY . . | |
| RUN mkdir -p /out && \ | |
| RUN --mount=type=cache,target=/go/pkg/mod \ | |
| go mod download | |
| COPY . . | |
| RUN --mount=type=cache,target=/go/pkg/mod \ | |
| --mount=type=cache,target=/root/.cache/go-build \ | |
| mkdir -p /out && \ |
Uh oh!
There was an error while loading. Please reload this page.