-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
integration/testdata/docker-run-with-build-args/base/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM golang:1.23 as builder | ||
WORKDIR /code | ||
COPY main.go . | ||
COPY go.mod . | ||
# `skaffold debug` sets SKAFFOLD_GO_GCFLAGS to disable compiler optimizations | ||
ARG SKAFFOLD_GO_GCFLAGS | ||
ARG IMAGE_REPO | ||
ARG IMAGE_NAME | ||
ARG IMAGE_TAG | ||
RUN go build -gcflags="${SKAFFOLD_GO_GCFLAGS}" -ldflags="-X main.ImageRepo=${IMAGE_REPO} -X main.ImageName=${IMAGE_NAME} -X main.ImageTag=${IMAGE_TAG}" -trimpath -o /app main.go | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/GoogleContainerTools/skaffold/examples/docker-deploy-with-build-args/base | ||
|
||
go 1.23 |
13 changes: 13 additions & 0 deletions
13
integration/testdata/docker-run-with-build-args/base/main.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
var ImageRepo = "unknown" | ||
var ImageTag = "unknown" | ||
var ImageName = "unknown" | ||
|
||
func main() { | ||
fmt.Printf("IMAGE_REPO: %s, IMAGE_NAME: %s, IMAGE_TAG:%s", ImageRepo, ImageName, ImageTag) | ||
} |
5 changes: 5 additions & 0 deletions
5
integration/testdata/docker-run-with-build-args/child/Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ARG BASE | ||
FROM $BASE as parent | ||
FROM alpine | ||
COPY --from=parent /app . | ||
CMD ["./app"] |
29 changes: 29 additions & 0 deletions
29
integration/testdata/docker-run-with-build-args/skaffold.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
apiVersion: skaffold/v4beta12 | ||
kind: Config | ||
build: | ||
tagPolicy: | ||
sha256: {} | ||
local: | ||
push: false | ||
useDockerCLI: true | ||
artifacts: | ||
- image: gcr.io/k8s-skaffold/skaffold | ||
context: base | ||
docker: | ||
dockerfile: Dockerfile | ||
noCache: true | ||
buildArgs: | ||
IMAGE_REPO: '{{.IMAGE_REPO}}' | ||
IMAGE_NAME: '{{.IMAGE_NAME}}' | ||
IMAGE_TAG: '{{.IMAGE_TAG}}' | ||
- image: child | ||
requires: | ||
- image: gcr.io/k8s-skaffold/skaffold | ||
alias: BASE | ||
context: child | ||
docker: | ||
dockerfile: Dockerfile | ||
noCache: true | ||
deploy: | ||
docker: | ||
images: [child] |