Skip to content

Commit 8875ae8

Browse files
committed
feat: allow to provide own Dockerfile
1 parent 68a2b00 commit 8875ae8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Taskfile_library.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ vars:
4343
MODULE_NAME:
4444
sh: 'cat "{{.ROOT_DIR2}}/go.mod" | grep "module " | sed "s/module //" | sed -E "s/[[:blank:]].*//"'
4545
NESTED_MODULES: '{{.NESTED_MODULES | default "" }}'
46+
DOCKERFILE: '{{.TASKFILE_DIR2}}/Dockerfile'
4647

4748
LOCALBIN: '{{ env "LOCALBIN" | default ( .LOCALBIN | default (print .ROOT_DIR2 "/bin") ) }}'
4849
LOCALTMP: '{{ env "LOCALTMP" | default ( .LOCALTMP | default (print .ROOT_DIR2 "/tmp") ) }}'

tasks_build_img.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,11 @@ tasks:
8282
- ARCH
8383
- IMAGE_BASE
8484
- DOCKER_BUILDER_NAME
85+
- DOCKERFILE
8586
cmds:
8687
- 'echo "Building image {{.COMPONENT}}:{{.VERSION}}-{{.OS}}-{{.ARCH}}"'
8788
- '[[ "{{.OS}}" == "linux" ]] || { echo "The distroless base image does only support linux as operating system."; exit 1; }'
88-
- 'cat "{{.TASKFILE_DIR2}}/Dockerfile" | sed "s/<component>/{{.COMPONENT}}/g" > "{{.ROOT_DIR2}}/Dockerfile.tmp"'
89+
- 'cat "{{.DOCKERFILE}}" | sed "s/<component>/{{.COMPONENT}}/g" > "{{.ROOT_DIR2}}/Dockerfile.tmp"'
8990
- '( cd "{{.ROOT_DIR2}}"; docker buildx build --builder {{.DOCKER_BUILDER_NAME}} --load --build-arg COMPONENT={{.COMPONENT}} --platform {{.OS}}/{{.ARCH}} -t {{.IMAGE_BASE}}/{{.COMPONENT}}:{{.VERSION}}-{{.OS}}-{{.ARCH}} -f Dockerfile.tmp . )'
9091
- 'rm -f "{{.ROOT_DIR2}}/Dockerfile.tmp"'
9192
internal: true

0 commit comments

Comments
 (0)