From 239c6038c18a512088cf377df9629ec295d1d05d Mon Sep 17 00:00:00 2001 From: Spencer Judge Date: Tue, 6 Dec 2022 11:29:59 -0800 Subject: [PATCH] Change submodule rather than whole new checkout --- .github/workflows/docker-build-only.yml | 15 +++++---------- admin-tools.Dockerfile | 10 +++++----- server.Dockerfile | 10 +++++----- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/.github/workflows/docker-build-only.yml b/.github/workflows/docker-build-only.yml index 4310fb61..35e2a471 100644 --- a/.github/workflows/docker-build-only.yml +++ b/.github/workflows/docker-build-only.yml @@ -37,11 +37,11 @@ jobs: submodules: "true" - name: Checkout temporal server repository - uses: actions/checkout@v3 - with: - repository: ${{ inputs.temporal-server-repo-path }} - path: temporal-server-checkedout - ref: ${{ inputs.temporal-server-repo-ref }} + run: | + git submodule set-url temporal ${{ format('https://github.com/{0}', inputs.temporal-server-repo-path) }} + cd temporal + git fetch + git checkout ${{ inputs.temporal-server-repo-ref }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -53,9 +53,6 @@ jobs: with: context: . file: server.Dockerfile - build-args: | - TEMPORAL_REPO_PATH=temporal-server-checkedout - GOFLAGS=-buildvcs=false tags: localhost:5000/temporal-server:latest push: true @@ -65,9 +62,7 @@ jobs: context: . file: admin-tools.Dockerfile build-args: | - TEMPORAL_REPO_PATH=temporal-server-checkedout SERVER_IMAGE=localhost:5000/temporal-server:latest - GOFLAGS=-buildvcs=false tags: localhost:5000/temporal-admin-tools:latest push: true diff --git a/admin-tools.Dockerfile b/admin-tools.Dockerfile index bf6de653..b3d1f877 100644 --- a/admin-tools.Dockerfile +++ b/admin-tools.Dockerfile @@ -5,18 +5,18 @@ ARG GOPROXY ##### Temporal Admin Tools builder ##### FROM ${BASE_BUILDER_IMAGE} AS admin-tools-builder -ARG TEMPORAL_REPO_PATH=temporal -ARG GOFLAGS -ENV GOFLAGS ${GOFLAGS} WORKDIR /home/builder # cache Temporal packages as a docker layer -COPY ./${TEMPORAL_REPO_PATH}/go.mod ./${TEMPORAL_REPO_PATH}/go.sum ./temporal/ +COPY ./temporal/go.mod ./temporal/go.sum ./temporal/ RUN (cd ./temporal && go mod download all) # build -COPY ./${TEMPORAL_REPO_PATH} ./temporal +COPY ./temporal ./temporal +# Git info is needed for Go build to attach VCS information properly +COPY ./.git ./.git +COPY ./.gitmodules ./.gitmodules RUN (cd ./temporal && make temporal-cassandra-tool temporal-sql-tool tdbg) diff --git a/server.Dockerfile b/server.Dockerfile index 88322d1c..cd8df2e3 100644 --- a/server.Dockerfile +++ b/server.Dockerfile @@ -3,14 +3,11 @@ ARG BASE_SERVER_IMAGE=temporalio/base-server:1.12.0 ##### Builder ##### FROM ${BASE_BUILDER_IMAGE} AS temporal-builder -ARG TEMPORAL_REPO_PATH=temporal -ARG GOFLAGS -ENV GOFLAGS ${GOFLAGS} WORKDIR /home/builder # cache Temporal packages as a docker layer -COPY ./${TEMPORAL_REPO_PATH}/go.mod ./${TEMPORAL_REPO_PATH}/go.sum ./temporal/ +COPY ./temporal/go.mod ./temporal/go.sum ./temporal/ RUN (cd ./temporal && go mod download all) # cache tctl packages as a docker layer @@ -19,7 +16,10 @@ RUN (cd ./tctl && go mod download all) # build COPY ./tctl ./tctl -COPY ./${TEMPORAL_REPO_PATH} ./temporal +COPY ./temporal ./temporal +# Git info is needed for Go build to attach VCS information properly +COPY ./.git ./.git +COPY ./.gitmodules ./.gitmodules RUN (cd ./temporal && make temporal-server) RUN (cd ./tctl && make build)