Automatically build latest Docker image

This commit is contained in:
Jyri-Petteri Paloposki 2022-08-16 00:45:34 +03:00
parent 6e27633f64
commit 21e1009ad7
2 changed files with 47 additions and 29 deletions

View file

@ -0,0 +1,47 @@
name: 'build'
on:
push:
branches:
- master
pull_request:
jobs:
build-and-publish-latest:
name: 'Build latest'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # Checking out the repo
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
tracksapp/tracks:latest
tracksapp/tracks:master
ghcr.io/TracksApp/tracks:latest
#ghcr.io/TracksApp/tracks:1.0.0
#tracksapp/tracks:1.0.0

View file

@ -1,29 +0,0 @@
version: '3'
services:
db:
image: mysql:5.7
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
MYSQL_DATABASE: ${TRACKS_DB:-tracks}
volumes:
- db-data:/var/lib/mysql
web:
build:
context: ..
dockerfile: Dockerfile-2.6
environment:
# These are set in script/ci-build, so we need to pass-thru them.
RAILS_ENV: $RAILS_ENV
DATABASE_NAME: $DATABASE_NAME
DATABASE_USERNAME: root
DATABASE_PASSWORD_EMPTY: 1
volumes:
- ${VOLUME:-..}:/app:Z
- ${VOLUME:-..}/config/database.docker.yml:/app/config/database.yml:Z
- ${VOLUME:-..}/config/site.docker.yml:/app/config/site.yml:Z
ports:
- 3000:3000
depends_on:
- db
volumes:
db-data: