-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7052 from freedomofpress/ci-demo
Have CI verify demo container builds and runs
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Demo | ||
|
||
on: [push, pull_request] | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
build: | ||
name: Build demo | ||
runs-on: ubuntu-22.04 | ||
env: | ||
DOCKERIZE_VERSION: v0.6.1 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build container | ||
run: | | ||
podman build -t demo -f securedrop/dockerfiles/focal/python3/DemoDockerfile . | ||
- name: Install dockerize | ||
run: | | ||
wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | ||
tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | ||
rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | ||
- name: Run container and verify it's up | ||
run: | | ||
function debug() { | ||
# Dump container logs on failure | ||
podman logs demo | ||
exit 1 | ||
} | ||
# Start the container in the background | ||
podman run --name=demo -d -t -p 8080:8080 -p 8081:8081 demo | ||
# And wait for both ports to be up! | ||
dockerize -wait http://127.0.0.1:8080 -timeout 2m || debug | ||
dockerize -wait http://127.0.0.1:8081 -timeout 2m || debug |