Add a script to test the image
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
7717618df8
commit
2cad146358
@ -1 +1,2 @@
|
||||
.idea
|
||||
.idea
|
||||
id_rsa*
|
||||
|
@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
root_dir=$(readlink -f $(dirname $(realpath "$0"))/..)
|
||||
if ! [ -f "$root_dir"/id_rsa ]; then
|
||||
echo 'Generating SSH key'
|
||||
ssh-keygen -t rsa -f "$root_dir"/id_rsa -q -N ''
|
||||
fi
|
||||
|
||||
run_image() {
|
||||
local branch=$1
|
||||
local pubkey=$(<"$root_dir"/id_rsa.pub)
|
||||
shift
|
||||
docker network inspect codefirst &> /dev/null || docker network create codefirst
|
||||
docker volume create --name=codefirst-docdeployer-drone
|
||||
docker volume create --name=codefirst-docdeployer-docs
|
||||
docker volume create --name=codefirst-nginx
|
||||
nginx_id=$(docker run --rm -d -v codefirst-nginx:/usr/share/nginx --net=codefirst -e PUBLIC_KEY="$pubkey" -e USER_NAME=codefirst --hostname=nginx linuxserver/openssh-server)
|
||||
sleep 1 # Wait to let the container start
|
||||
docker run -v codefirst-docdeployer-drone:/drone/src \
|
||||
-v codefirst-docdeployer-docs:/docs \
|
||||
--net=codefirst \
|
||||
-e DRONE_REPO_NAME=hello-world \
|
||||
-e DRONE_REPO_OWNER=octocat \
|
||||
-e DRONE_REPO=octocat/hello-world \
|
||||
-e DRONE_BRANCH=$branch \
|
||||
-e DRONE_COMMIT=7fd1a60b01f91b314f59955a4e4d4e80d8edf11d \
|
||||
--entrypoint '/bin/bash' \
|
||||
--rm codefirst-docdeployer \
|
||||
-c "sed -i 's/ssh/ssh -p 2222/g' /entrypoint.sh && sed -i 's/root@nginx/codefirst@nginx/g' /entrypoint.sh && $*"
|
||||
docker stop "$nginx_id"
|
||||
}
|
||||
|
||||
docker build -t codefirst-docdeployer "$root_dir"
|
||||
|
||||
run_image main 'doxygen -g && /entrypoint.sh -b main -l . -t doxygen -d sourcecode_documentation'
|
Loading…
Reference in new issue