Use latest tag in docker-compose.ci.yml #18
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
name: Build and test containers | |
on: | |
pull_request: | |
push: | |
jobs: | |
build: | |
name: Build docker images | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: | |
- app | |
- gis | |
- ui | |
- web | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# - name: Cache | |
# uses: actions/cache@v3 | |
# id: cache | |
# with: | |
# path: | | |
# var-cache-apt | |
# var-lib-apt | |
# key: cache-${{ matrix.service }}-${{ hashFiles( format('{0}/{1}', matrix.service, 'Dockerfile')) }} | |
# - name: inject cache into docker | |
# uses: reproducible-containers/buildkit-cache-dance@v3.1.0 | |
# with: | |
# cache-map: | | |
# { | |
# "var-cache-apt": "/var/cache/apt", | |
# "var-lib-apt": "/var/lib/apt" | |
# } | |
# skip-extraction: ${{ steps.cache.outputs.cache-hit }} | |
- name: Build and export image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ${{ matrix.service }} | |
tags: smithmicro/n7m-${{ matrix.service }}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=docker,dest=/tmp/${{ matrix.service }}.tar | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.service }} | |
path: /tmp/${{ matrix.service }}.tar | |
test: | |
name: Test docker images | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: /tmp | |
- name: Load docker images | |
run: |- | |
docker load --input /tmp/app.tar | |
docker load --input /tmp/gis.tar | |
docker load --input /tmp/ui.tar | |
docker load --input /tmp/web.tar | |
docker image ls -a | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Cache OSM data | |
uses: actions/cache@v4 | |
with: | |
path: data | |
key: monaco-osm | |
- name: Download initial OSM data | |
run: |- | |
wget --timestamping --directory-prefix=./data https://download.geofabrik.de/europe/monaco-latest.osm.pbf | |
- name: Start docker containers and setup DB | |
run: |- | |
echo "::notice:Starting containers" | |
docker compose -f docker-compose.yml -f .github/docker-compose.ci.yml up --wait --wait-timeout 120 --pull never --no-build web | |
echo "::notice:Starting setup" | |
docker compose -f docker-compose.yml -f .github/docker-compose.ci.yml up --pull never --no-build feed | |
- name: Test API health | |
run: |- | |
curl --fail-with-body http://localhost:8080/health |