| 1 |
# This Dockerfile aims to have at least one of everything, to exercise the |
| 2 |
# comprehensiveness of Dockerfile feature support. |
| 3 |
# |
| 4 |
# FIXME: That focus is a bit out of date. I think really what is here is the |
| 5 |
# ways we want to exercise ch-image in ways we care about the resulting image. |
| 6 |
# Exercises where we don’t care are in test/build/50_dockerfile.bats. But, I |
| 7 |
# don't want to do the refactoring right now. |
| 8 |
# |
| 9 |
# See: https://docs.docker.com/engine/reference/builder |
| 10 |
# |
| 11 |
# ch-test-scope: full |
| 12 |
# ch-test-builder-include: ch-image |
| 13 |
|
| 14 |
# Use a moderately complex image reference. |
| 15 |
FROM registry-1.docker.io:443/library/alpine:3.17 AS stage1 |
| 16 |
|
| 17 |
RUN pwd |
| 18 |
WORKDIR /usr/local/src |
| 19 |
RUN pwd |
| 20 |
RUN ls --color=no -lh |
| 21 |
|
| 22 |
RUN apk add --no-cache bc |
| 23 |
RUN ["echo", "hello \n${chse_2} \${chse_2} ${NOTSET}"] |
| 24 |
# should print: |
| 25 |
# a -${chse_2}- b -value2- c -c- d -d- |
| 26 |
RUN echo 'a -${chse_2}-' "b -${chse_2}-" "c -${NOTSET:-c}-" "d -${chse_2:+d}-" |
| 27 |
RUN env |
| 28 |
|
| 29 |
# WORKDIR. See test/build/50_ch-image.bats where we validate this all worked OK. |
| 30 |
# FIXME: test with variable |
| 31 |
# |
| 32 |
# filesystem root |
| 33 |
WORKDIR / |
| 34 |
RUN mkdir workdir |
| 35 |
# absolute path, no mkdir |
| 36 |
WORKDIR /workdir |
| 37 |
RUN touch file |
| 38 |
# absolute path, mkdir |
| 39 |
RUN mkdir /workdir/abs2 |
| 40 |
WORKDIR /workdir/abs2 |
| 41 |
RUN touch file |
| 42 |
# relative path, no mkdir |
| 43 |
WORKDIR rel1 |
| 44 |
RUN touch file1 |
| 45 |
# relative path, 2nd level, no mkdir |
| 46 |
WORKDIR rel2 |
| 47 |
RUN touch file |
| 48 |
# relative path, parent dir, no mkdir |
| 49 |
WORKDIR .. |
| 50 |
RUN touch file2 |
| 51 |
# results |
| 52 |
RUN ls -R /workdir |
| 53 |
|
| 54 |
# TODO: |
| 55 |
# comment with trailing backslash (line continuation does not work in comments) |
| 56 |
|