From d0689a8c4e177f2e1e917be50f40028ea3766545 Mon Sep 17 00:00:00 2001 From: "Aljaz S." <117018081+aljazs-flare@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:51:52 +0000 Subject: [PATCH 1/3] build services container --- ...ild-container.yml => build-containers.yml} | 15 +++++++--- Dockerfile => dockerfile.indexer | 1 - dockerfile.services | 28 +++++++++++++++++++ 3 files changed, 39 insertions(+), 5 deletions(-) rename .github/workflows/{build-container.yml => build-containers.yml} (66%) rename Dockerfile => dockerfile.indexer (90%) create mode 100644 dockerfile.services diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-containers.yml similarity index 66% rename from .github/workflows/build-container.yml rename to .github/workflows/build-containers.yml index 7994b85..f243b35 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-containers.yml @@ -29,10 +29,17 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push default image + - name: Build and push indexer container uses: docker/build-push-action@v3.2.0 with: - context: . # Because GH actions are for kids and put protection on everything; https://stackoverflow.com/a/71159809/11276254 + context: . push: true - tags: | - ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }} + file: dockerfile.indexer + tags: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }} + - name: Build and push services container + uses: docker/build-push-action@v3.2.0 + with: + context: . + push: true + file: dockerfile.services + tags: ghcr.io/${{ github.repository }}/services:${{ env.IMAGE_TAG }} diff --git a/Dockerfile b/dockerfile.indexer similarity index 90% rename from Dockerfile rename to dockerfile.indexer index 4b86170..32906a3 100644 --- a/Dockerfile +++ b/dockerfile.indexer @@ -12,7 +12,6 @@ COPY . ./ # Build the applications RUN go build -o /app/flare_indexer ./indexer/main/indexer.go -# RUN go build -o /app/flare_services ./services/main/services.go FROM debian:latest AS execution diff --git a/dockerfile.services b/dockerfile.services new file mode 100644 index 0000000..47ccda1 --- /dev/null +++ b/dockerfile.services @@ -0,0 +1,28 @@ +# build executable +FROM golang:1.18 AS builder + +WORKDIR /build + +# Copy and download dependencies using go mod +COPY go.mod go.sum ./ +RUN go mod download + +# Copy the code into the container +COPY . ./ + +# Build the applications +RUN go build -o /app/flare_services ./services/main/services.go + +FROM debian:latest AS execution + +ARG deployment=flare +ARG type=voting + +RUN apt-get -y update && apt-get -y install curl + +WORKDIR /app +COPY --from=builder /app/flare_services . +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY ./docker/indexer/config_${deployment}_${type}.toml ./config.toml + +CMD ["./flare_services", "--config", "/app/config.toml" ] \ No newline at end of file From 8392e1413fa72669417ccf106edec96d5cf28525 Mon Sep 17 00:00:00 2001 From: "Aljaz S." <117018081+aljazs-flare@users.noreply.github.com> Date: Wed, 11 Oct 2023 15:58:01 +0000 Subject: [PATCH 2/3] tag the indexer image with subpath {repo}/indexer --- .github/workflows/build-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-containers.yml index f243b35..d477a61 100644 --- a/.github/workflows/build-containers.yml +++ b/.github/workflows/build-containers.yml @@ -35,7 +35,7 @@ jobs: context: . push: true file: dockerfile.indexer - tags: ghcr.io/${{ github.repository }}:${{ env.IMAGE_TAG }} + tags: ghcr.io/${{ github.repository }}/indexer:${{ env.IMAGE_TAG }} - name: Build and push services container uses: docker/build-push-action@v3.2.0 with: From a4623517a4202873ad2569ce57938c7013908043 Mon Sep 17 00:00:00 2001 From: mboben Date: Thu, 12 Oct 2023 11:35:12 +0200 Subject: [PATCH 3/3] Update dockerfile.services --- dockerfile.services | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dockerfile.services b/dockerfile.services index 47ccda1..b709271 100644 --- a/dockerfile.services +++ b/dockerfile.services @@ -16,13 +16,12 @@ RUN go build -o /app/flare_services ./services/main/services.go FROM debian:latest AS execution ARG deployment=flare -ARG type=voting RUN apt-get -y update && apt-get -y install curl WORKDIR /app COPY --from=builder /app/flare_services . COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY ./docker/indexer/config_${deployment}_${type}.toml ./config.toml +COPY ./docker/indexer/config_${deployment}_services.toml ./config.toml -CMD ["./flare_services", "--config", "/app/config.toml" ] \ No newline at end of file +CMD ["./flare_services", "--config", "/app/config.toml" ]