diff --git a/tests/build/README.md b/tests/build/README.md new file mode 100644 index 0000000..e67b421 --- /dev/null +++ b/tests/build/README.md @@ -0,0 +1,25 @@ +# Test podman-compose with build + +``` +podman-compose build +podman-compose up -d +curl http://localhost:8080/index.txt +curl http://localhost:8000/index.txt +podman inspect my-busybox-httpd2 +podman-compose down +``` + +expected output would be something like + +``` +2019-09-03T15:16:38+0000 +ALT buildno=2 port 8000 2019-09-03T15:16:38+0000 +{ +... +} +``` + +as you can see we were able to override buildno to be 2 instead of 1, +and httpd_port to 8000. + +NOTE: build labels are not passed to `podman build` diff --git a/tests/build/context/Dockerfile b/tests/build/context/Dockerfile new file mode 100644 index 0000000..b49d3ae --- /dev/null +++ b/tests/build/context/Dockerfile @@ -0,0 +1,3 @@ +FROM busybox +RUN mkdir -p /var/www/html/ && date -Iseconds > /var/www/html/index.txt +CMD ["busybox", "httpd", "-f", "-p", "80", "-h", "/var/www/html"] diff --git a/tests/build/context/Dockerfile-alt b/tests/build/context/Dockerfile-alt new file mode 100644 index 0000000..e0e71d7 --- /dev/null +++ b/tests/build/context/Dockerfile-alt @@ -0,0 +1,7 @@ +FROM busybox +ARG buildno=1 +ARG httpd_port=80 +ENV httpd_port ${httpd_port} +RUN mkdir -p /var/www/html/ && \ + echo "ALT buildno=$buildno port=$httpd_port `date -Iseconds`" > /var/www/html/index.txt +CMD httpd -f -p "$httpd_port" -h /var/www/html diff --git a/tests/build/docker-compose.yml b/tests/build/docker-compose.yml new file mode 100644 index 0000000..6984b24 --- /dev/null +++ b/tests/build/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3" +services: + web1: + build: ./context + image: my-busybox-httpd + ports: + - 8080:80 + web2: + build: + context: ./context + dockerfile: Dockerfile-alt + labels: + mykey: myval + args: + buildno: 2 + httpd_port: 8000 + image: my-busybox-httpd2 + ports: + - 8000:8000