mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-09 09:27:03 +03:00
Add docker image test
This commit is contained in:
parent
25d9345a7d
commit
5fac68f2c4
4 changed files with 44 additions and 0 deletions
3
.docker/release/test/build.sh
Executable file
3
.docker/release/test/build.sh
Executable file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
docker build -t snappymail/snappymail:test -f .docker/release/Dockerfile .
|
||||||
25
.docker/release/test/config.yaml
Normal file
25
.docker/release/test/config.yaml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
# See: https://github.com/GoogleContainerTools/container-structure-test
|
||||||
|
# See: https://github.com/GoogleContainerTools/container-structure-test/issues/78
|
||||||
|
schemaVersion: 2.0.0
|
||||||
|
commandTests:
|
||||||
|
- name: Server starts
|
||||||
|
command: /bin/sh
|
||||||
|
args:
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
/entrypoint.sh > /tmp/out 2>&1 &
|
||||||
|
sleep 5
|
||||||
|
set -eux
|
||||||
|
cat /tmp/out
|
||||||
|
pidof supervisord
|
||||||
|
pidof nginx
|
||||||
|
pidof php-fpm
|
||||||
|
wget -S -T 3 -O /dev/null http://localhost:8888
|
||||||
|
kill `pidof supervisord`
|
||||||
|
metadataTest:
|
||||||
|
exposedPorts: ["8888", "9000"]
|
||||||
|
volumes: ["/var/lib/snappymail"]
|
||||||
|
entrypoint: []
|
||||||
|
cmd: ["/entrypoint.sh"]
|
||||||
|
workdir: /snappymail
|
||||||
|
user: ''
|
||||||
11
.docker/release/test/test.sh
Executable file
11
.docker/release/test/test.sh
Executable file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# This script tests a given docker image using https://github.com/GoogleContainerTools/container-structure-test
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
IMAGE=${1:-snappymail/snappymail:test}
|
||||||
|
SCRIPT_DIR=$( cd "$(dirname "$0")" && pwd )
|
||||||
|
docker inspect "$IMAGE" > /dev/null 2>&1 || docker pull "$IMAGE" # Pull the image if it doesn't exist in docker daemon
|
||||||
|
docker run --rm -i \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \
|
||||||
|
-v "$SCRIPT_DIR/config.yaml:/config.yaml:ro" \
|
||||||
|
gcr.io/gcp-runtimes/container-structure-test:latest test --image "$IMAGE" --config config.yaml
|
||||||
5
.github/workflows/docker.yml
vendored
5
.github/workflows/docker.yml
vendored
|
|
@ -94,6 +94,11 @@ jobs:
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
TAG=$( echo "${{ steps.meta.outputs.tags }}" | head -n1 )
|
||||||
|
.docker/release/test/test.sh "$TAG"
|
||||||
|
|
||||||
# Temp fix
|
# Temp fix
|
||||||
# https://github.com/docker/build-push-action/issues/252
|
# https://github.com/docker/build-push-action/issues/252
|
||||||
# https://github.com/moby/buildkit/issues/1896
|
# https://github.com/moby/buildkit/issues/1896
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue