test compose files with build

This commit is contained in:
Muayyad Alsadi 2019-09-03 18:35:56 +03:00
parent 7bc6782e0d
commit be2726da18
4 changed files with 54 additions and 0 deletions

25
tests/build/README.md Normal file
View File

@ -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`

View File

@ -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"]

View File

@ -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

View File

@ -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