Update Database Image #16
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: Update Database Image | |
on: | |
push: | |
paths: | |
- 'data/**' | |
workflow_dispatch: | |
jobs: | |
update-database-image: | |
runs-on: ubuntu-latest | |
if: github.repository == 'cbioportal/cbioportal-test' | |
env: | |
DOCKER_REPO: 'cbioportal/cbioportal-dev' | |
DOCKER_TAG: 'database' | |
PLATFORMS: 'linux/amd64,linux/arm64' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Log in to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up docker buildx for multi-platform builds | |
run: | | |
docker pull docker.io/tonistiigi/binfmt:latest | |
docker run --rm --privileged docker.io/tonistiigi/binfmt:latest --install all | |
docker buildx use cbioportal-test > /dev/null || docker buildx create --name cbioportal-test --driver docker-container --use | |
docker buildx inspect --bootstrap --builder cbioportal-test | |
- name: Update database dump | |
run: | | |
cd $GITHUB_WORKSPACE | |
sh scripts/docker-compose.sh --portal_type=web-and-data --docker_args='-d' | |
sh utils/check-connection.sh --url=localhost:8080 --interval=5 --max_retries=50 | |
sh scripts/import-data.sh --seed=./data/seed.sql.gz --schema=./data/cgds.sql --studies=./data/studies | |
sh scripts/dump-data.sh --url=localhost:8080 --out=database_dump.sql | |
- name: Push new docker image | |
run: | | |
cd $GITHUB_WORKSPACE | |
docker buildx build --push --platform $PLATFORMS --tag $DOCKER_REPO:$DOCKER_TAG --build-arg DUMP_PATH=database_dump.sql --file docker/cbioportal-database.Dockerfile --cache-from type=gha --cache-to type=gha . |