-
Notifications
You must be signed in to change notification settings - Fork 12
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 #6 from lanedirt/5-add-docker-compose-build-github…
…-action Create docker-compose-build.yml
- Loading branch information
Showing
1 changed file
with
45 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,45 @@ | ||
name: Docker Compose Build | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
test-docker: | ||
runs-on: ubuntu-latest | ||
services: | ||
docker: | ||
image: docker:26.0.0 | ||
options: --privileged | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Docker Compose | ||
run: | | ||
# Build the images and start the services | ||
docker compose -f docker-compose.yml up -d | ||
- name: Wait for services to be up | ||
run: | | ||
# Wait for a few seconds | ||
sleep 5 | ||
- name: Test if localhost:80 (WASM app) responds | ||
run: | | ||
# Test if the service on localhost:80 responds | ||
http_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:80) | ||
if [ "$http_code" -ne 200 ]; then | ||
echo "Service did not respond with 200 OK" | ||
exit 1 | ||
else | ||
echo "Service responded with 200 OK" | ||
fi | ||
- name: Test if localhost:81 (WebApi) responds | ||
run: | | ||
# Test if the service on localhost:81 responds | ||
http_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:81) | ||
if [ "$http_code" -ne 200 ] && [ "$http_code" -ne 404 ]; then | ||
echo "Service did not respond with expected 200 OK or 404 Not Found" | ||
exit 1 | ||
else | ||
echo "Service responded with $http_code" | ||
fi |