From dc8bfd401d5722e6409191b0530923c1f6828a9e Mon Sep 17 00:00:00 2001 From: Matthew McPherrin Date: Sat, 14 Dec 2024 21:03:46 -0500 Subject: [PATCH] Add dockerfile and GHA to build and publish ct-test-srv container --- .github/workflows/container-build.yml | 31 +++++++++++++++++++++ .github/workflows/container-release.yml | 37 +++++++++++++++++++++++++ test/ct-test-srv/Dockerfile | 19 +++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 .github/workflows/container-build.yml create mode 100644 .github/workflows/container-release.yml create mode 100644 test/ct-test-srv/Dockerfile diff --git a/.github/workflows/container-build.yml b/.github/workflows/container-build.yml new file mode 100644 index 00000000000..cd957d11585 --- /dev/null +++ b/.github/workflows/container-build.yml @@ -0,0 +1,31 @@ +# Build containers on every PR +# See also container-release.yml + +name: Container Build + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +jobs: + build-container: + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - dockerfile: test/ct-test-srv/Dockerfile + image: ghcr.io/mcpherrinm/ct-test-srv + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Build + run: docker buildx . -f "${{ matrix.image }}" -t "${{ image }}" diff --git a/.github/workflows/container-release.yml b/.github/workflows/container-release.yml new file mode 100644 index 00000000000..1933ef90e90 --- /dev/null +++ b/.github/workflows/container-release.yml @@ -0,0 +1,37 @@ +# Build and publish containers for this release +# see also container-build.yml + +name: Container Release + +on: + push: + tags: + - release-* + +jobs: + push-container: + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + include: + - dockerfile: TBD + image: ghcr.io/mcpherrinm/boulder + - dockerfile: test/ct-test-srv/Dockerfile + image: ghcr.io/mcpherrinm/ct-test-srv + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Build + run: docker buildx . -f "${{ matrix.image }}" -t "${{ image }}" + + - name: login + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin + + - name: Push + run: docker push "${{ image }}:${{ github.ref_name }}" diff --git a/test/ct-test-srv/Dockerfile b/test/ct-test-srv/Dockerfile new file mode 100644 index 00000000000..ac4185b771d --- /dev/null +++ b/test/ct-test-srv/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:1.23.4 AS build + +WORKDIR /app + +COPY go.mod go.sum vendor ./ + +COPY . . + +RUN go build -o /bin/ct-test-srv ./test/ct-test-srv/main.go + +FROM ubuntu:24.04 + +COPY --from=build /bin/ct-test-srv /bin/ct-test-srv + +COPY test/ct-test-srv/ct-test-srv.json /etc/ct-test-srv.json + +ENTRYPOINT ["/bin/ct-test-srv"] + +CMD ["-config", "/etc/ct-test-srv.json"]