Skip to content

Commit feda506

Browse files
Use Actions git context instead of dynamically created buildkit one (#25381)
The [docker/build-push-action@v2 action](https://github.com/docker/build-push-action) by default ignores the checkout created using the actions/checkout@v2 action. When you pass a git build context to docker build, it wouldn't include the .git directory. By passing `context: .` to the build step then it'll use the Actions git context which includes the git fetch from the earlier step.
1 parent ef6f5f0 commit feda506

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

.github/workflows/release-nightly.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@ jobs:
7878
- name: build rootful docker image
7979
uses: docker/build-push-action@v4
8080
with:
81+
context: .
8182
platforms: linux/amd64,linux/arm64
8283
push: true
8384
tags: gitea/gitea:${{ steps.clean_name.outputs.branch }}
8485
- name: build rootless docker image
8586
uses: docker/build-push-action@v4
8687
with:
88+
context: .
8789
platforms: linux/amd64,linux/arm64
8890
push: true
8991
file: Dockerfile.rootless

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ endif
7979
STORED_VERSION_FILE := VERSION
8080
HUGO_VERSION ?= 0.111.3
8181

82+
GITHUB_REF_TYPE ?= branch
83+
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
84+
8285
ifneq ($(GITHUB_REF_TYPE),branch)
8386
VERSION ?= $(subst v,,$(GITHUB_REF_NAME))
8487
GITEA_VERSION ?= $(GITHUB_REF_NAME)
@@ -1011,9 +1014,5 @@ docker:
10111014
docker build --disable-content-trust=false -t $(DOCKER_REF) .
10121015
# support also build args docker build --build-arg GITEA_VERSION=v1.2.3 --build-arg TAGS="bindata sqlite sqlite_unlock_notify" .
10131016

1014-
.PHONY: docker-build
1015-
docker-build:
1016-
docker run -ti --rm -v "$(CURDIR):/srv/app/src/code.gitea.io/gitea" -w /srv/app/src/code.gitea.io/gitea -e TAGS="bindata $(TAGS)" LDFLAGS="$(LDFLAGS)" CGO_EXTRA_CFLAGS="$(CGO_EXTRA_CFLAGS)" webhippie/golang:edge make clean build
1017-
10181017
# This endif closes the if at the top of the file
10191018
endif

0 commit comments

Comments
 (0)