diff --git a/.github/workflows/docker-build-only.yml b/.github/workflows/docker-build-only.yml index 4310fb61..75d5ea1b 100644 --- a/.github/workflows/docker-build-only.yml +++ b/.github/workflows/docker-build-only.yml @@ -37,11 +37,22 @@ 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 }} + # I have no idea why all this hullabaloo with explicitly fetching the other repo's branch + # is necessary, you should be able to just `git submodule update --init` and have it work, + # but possibly something about the barebones nature of the checkout action makes that not + # work. + run: | + git submodule set-url temporal ${{ format('https://github.com/{0}', inputs.temporal-server-repo-path) }} + git submodule set-branch --branch ${{ inputs.temporal-server-repo-ref }} -- temporal + git submodule sync + cat .gitmodules + echo "Updating temporal submodule" + cd temporal + git remote show origin + git fetch --depth 1 origin ${{ inputs.temporal-server-repo-ref }}:refs/remotes/origin/${{ inputs.temporal-server-repo-ref }} + git checkout origin/${{ inputs.temporal-server-repo-ref }} + cd .. + git submodule status temporal - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -53,9 +64,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 +73,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 @@ -85,7 +91,7 @@ jobs: # Upload-artifact has no good way to flatten paths, so we need to move the compose file # to avoid some disgustingly long inner path inside the artifact zip. - name: Copy compose file - run: cp ./temporal-server-checkedout/develop/docker-compose/docker-compose.yml /tmp/docker-compose.yml + run: cp ./temporal/develop/docker-compose/docker-compose.yml /tmp/docker-compose.yml - name: Upload artifacts uses: actions/upload-artifact@v3 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)