Docker Image CI #941
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: Docker Image CI | |
on: | |
schedule: | |
- cron: '0 6 * * *' | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker login | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin | |
- name: Docker build | |
run: docker build . --file Dockerfile --tag fmidev/smartmetserver:latest | |
- name: Docker test | |
run: | | |
docker run --name test --rm -p 127.0.0.1:8080:8080 fmidev/smartmetserver:latest &> debug.log & | |
sleep 45 | |
cat debug.log | |
docker logs test | |
curl -f "http://localhost:8080/wms?request=getCapabilities&service=WMS" || exit 1 | |
docker stop test | |
- name: Docker tag | |
run: docker image tag fmidev/smartmetserver:latest fmidev/smartmetserver:$(date +%y.%m.%d -d @$(docker run --rm fmidev/smartmetserver:latest rpm -qa --queryformat %'{buildtime}\n' smartmet-*|sort -n|tail -1)) | |
- name: Docker push | |
run: docker push --all-tags fmidev/smartmetserver |