mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-09-03 16:07:43 +00:00
Ability to parse args from Dockerfile
We should check if we have args in "FROM" and replace them: ARG IMAGE=linuxkit/img FROM ${IMAGE} as src will be parsed as FROM linuxkit/img as src Signed-off-by: Petr Fedchenkov <giggsoff@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
ARG IMAGE=alpine
|
||||
ARG TAG=3.15
|
||||
FROM ${IMAGE}:${TAG}
|
||||
|
||||
COPY foo /foo
|
@@ -0,0 +1,5 @@
|
||||
image: chained-build-with-args-image1-test-does-not-exist-anywhere-else-123456789 # this must be used as FROM in the chained image
|
||||
network: true
|
||||
arches:
|
||||
- amd64
|
||||
- arm64
|
@@ -0,0 +1 @@
|
||||
bar
|
@@ -0,0 +1,7 @@
|
||||
# those IMAGE and TAG *must* be updated when changing ../build1; just run `lkt pkg show-tag ../build1` and place it here
|
||||
ARG IMAGE=linuxkit/chained-build-with-args-image1-test-does-not-exist-anywhere-else-123456789
|
||||
ARG TAG=6a40ba0866b7ce18b3b13390bf88bfeb6ac0db4e
|
||||
FROM ${IMAGE}:${TAG} as src
|
||||
FROM alpine:3.15
|
||||
COPY --from=src /foo /foo
|
||||
RUN cat /foo
|
@@ -0,0 +1,5 @@
|
||||
image: chained-build-with-args-test-second
|
||||
network: true
|
||||
arches:
|
||||
- amd64
|
||||
- arm64
|
19
test/cases/000_build/041_chained_builds_with_args/test.sh
Executable file
19
test/cases/000_build/041_chained_builds_with_args/test.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# SUMMARY: Check that chained builds support args
|
||||
# LABELS:
|
||||
# REPEAT:
|
||||
|
||||
set -ex
|
||||
|
||||
# Source libraries. Uncomment if needed/defined
|
||||
#. "${RT_LIB}"
|
||||
. "${RT_PROJECT_ROOT}/_lib/lib.sh"
|
||||
|
||||
# Test code goes here
|
||||
echo linuxkit is "$(which linuxkit)"
|
||||
|
||||
# build the first, use it to build the second
|
||||
linuxkit pkg build --force ./build1
|
||||
linuxkit pkg build --force ./build2
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user