Allow manually building image #4
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 | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: {} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15.4 | |
env: | |
POSTGRES_USER: discourse | |
POSTGRES_PASSWORD: discourse | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
redis: | |
image: redis:7.2 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Checkout discourse_docker | |
uses: actions/checkout@v3 | |
with: | |
repository: discourse/discourse_docker | |
path: discourse_docker | |
- name: Copy container definition | |
run: cp web_only.yml discourse_docker/containers/web_only.yml | |
- name: Build container | |
run: | | |
NETWORK_ID=$(docker network ls --filter=name=github_network_ --format="{{.ID}}") | |
discourse_docker/launcher bootstrap web_only --docker-args "--network=$NETWORK_ID" | |
- name: Login to DigitalOcean Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.digitalocean.com | |
username: ${{ secrets.DO_REGISTRY_USERNAME }} | |
password: ${{ secrets.DO_REGISTRY_USERNAME }} | |
- name: Push image | |
run: | | |
TAG=$(echo $GITHUB_RUN_ID$GITHUB_RUN_ATTEMPT | sha256sum | head -c8) | |
SOURCE_IMAGE=local_discourse/web_only:latest | |
TARGET_IMAGE=registry.digitalocean.com/vatsim-containers/discourse:$TAG | |
docker tag $SOURCE_IMAGE $TARGET_IMAGE | |
docker push $TARGET_IMAGE | |
echo ":shipit: \`$TARGET_IMAGE\`" >> $GITHUB_STEP_SUMMARY |