Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
906c8e97e8 |
@@ -24,6 +24,11 @@ FROM golang@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4
|
|||||||
|
|
||||||
RUN apk add --no-cache git make gcc musl-dev binutils-gold
|
RUN apk add --no-cache git make gcc musl-dev binutils-gold
|
||||||
|
|
||||||
|
# A build context sent as a tar archive keeps its files' owners, and git
|
||||||
|
# refuses to read a checkout owned by another user. Trust this one
|
||||||
|
# whoever owns it.
|
||||||
|
RUN git config --system --add safe.directory /src
|
||||||
|
|
||||||
# Force BuildKit to run the lint stage before proceeding
|
# Force BuildKit to run the lint stage before proceeding
|
||||||
COPY --from=lint /src/go.sum /dev/null
|
COPY --from=lint /src/go.sum /dev/null
|
||||||
|
|
||||||
|
|||||||
@@ -592,15 +592,19 @@ appears in the startup log and in the health check response.
|
|||||||
|
|
||||||
The image takes it the same way, from the `.git` the build context carries, so a
|
The image takes it the same way, from the `.git` the build context carries, so a
|
||||||
plain `docker build .` of a clone stamps the commit it was built from; a clone
|
plain `docker build .` of a clone stamps the commit it was built from; a clone
|
||||||
without tags stamps the short commit. A shallow clone carries only a tag on its
|
without tags stamps the short commit. A clone made with `--depth 1` carries at
|
||||||
own commit, so a shallow clone of an untagged commit stamps the short commit.
|
most a tag on its own commit, so such a clone of an untagged commit stamps the
|
||||||
`.dockerignore` sends `.git` without `.git/config`, which `git describe` does
|
short commit. In a build from a directory, `.dockerignore` keeps out
|
||||||
not need and which can hold a credential. A non-empty `--build-arg VERSION=...`
|
`.git/config`, which `git describe` does not need and which can hold a
|
||||||
takes precedence; `make docker` passes the version `git describe` gives on the
|
credential. Docker does not apply `.dockerignore` to a context sent as a tar
|
||||||
host. The build fails when the context carries `.git`, as a directory or as a
|
archive, as upaas sends it, so that context carries `.git/config` into the
|
||||||
file, and the version comes out empty, `dev` or `unknown`. `.dockerignore` must
|
build. It also keeps its files' owners, so git in the build trusts the checkout
|
||||||
list no tracked file: git in the build would see it as deleted and mark the
|
whoever owns it. A non-empty `--build-arg VERSION=...` takes precedence;
|
||||||
version `-dirty`.
|
`make docker` passes the version `git describe` gives on the host. The build
|
||||||
|
fails when the context carries `.git`, as a directory or as a file, and the
|
||||||
|
version comes out empty, `dev` or `unknown`. `.dockerignore` must list no
|
||||||
|
tracked file: git in the build would see it as deleted and mark the version
|
||||||
|
`-dirty`.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user