Skip to content

Commit

Permalink
WIP: add compose image and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusSchoelzel committed Jun 29, 2021
1 parent 5706153 commit 2f76d3d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Dockerfile-compose
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ARG BASEIMAGE
FROM ${BASEIMAGE}
RUN apk add --no-cache curl docker-compose
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,23 @@ podman-remote:
podman-ssh: podman
$(DOCKER) build --force-rm -t $(PODMAN_SSH_IMAGE) -f Dockerfile-ssh --build-arg BASEIMAGE=$(PODMAN_IMAGE) .

test: test-local-rootless test-local-rootful test-minimal-image podman-remote
podman-compose: podman
$(DOCKER) build --force-rm -t $(PODMAN_COMPOSE_IMAGE) -f Dockerfile-compose --build-arg BASEIMAGE=$(PODMAN_IMAGE) .

test: test-local-rootless test-local-rootful test-local-rootless-docker-compose test-minimal-image podman-remote

test-local-rootful: podman storage-dir
IMAGE=$(PODMAN_IMAGE) ./test/test-local-rootful.sh

test-local-rootless: podman storage-dir
IMAGE=$(PODMAN_IMAGE) ./test/test-local-rootless.sh

test-local-rootless-docker-compose: podman-compose
$(DOCKER) run --rm --privileged -u podman:podman \
--mount "type=bind,src=`pwd`/test/test-rootless-compose.sh,dst=/test-rootless-compose.sh" \
$(PODMAN_COMPOSE_IMAGE) \
/bin/sh -c /test-rootless-compose.sh

test-minimal-image: podman-minimal storage-dir
IMAGE=$(PODMAN_MINIMAL_IMAGE) TEST_PREDICATE=MINIMAL SKIP_PORTMAPPING_TEST=true ./test/test-local-rootless.sh

Expand Down
33 changes: 33 additions & 0 deletions test/test-rootless-compose.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh

echo
echo TEST DOCKER-COMPOSE IN PODMAN
echo

set -eu

cat <<EOF > /tmp/docker-compose.yml
version: "3"
services:
reverse-proxy:
image: traefik:v2.4
command: --api.insecure=true --providers.docker
ports:
- "80:80"
- "8080:8080"
volumes:
- /tmp/podman.sock:/var/run/docker.sock
whoami:
image: traefik/whoami
labels:
- "traefik.http.routers.whoami.rule=Host(\`whoami.docker.localhost\`)"
- "traefik.http.services.whoami.loadbalancer.server.port=80"
EOF

podman system service --time 0 unix:///tmp/podman.sock &
sleep 5
docker-compose -H unix:///tmp/podman.sock -f /tmp/docker-compose.yml up -d
sleep 5
curl -H "Host:whoami.docker.localhost" http://127.0.0.1

0 comments on commit 2f76d3d

Please sign in to comment.