Skip to content

Commit

Permalink
Merge pull request getodk#299 from yanokwa/update-docker
Browse files Browse the repository at this point in the history
Build image on every push, hide secrets, more consistent naming
  • Loading branch information
Florian Mayer authored Mar 22, 2022
2 parents 9349244 + 87285f6 commit 0c9dd11
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 59 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/docker.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: GHCR

on: push

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Login against a Docker registry
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \

# Install Ruby gems and ODK Build
ENV RACK_ENV production
# The build2xlsform hostname is "build2xlsform" when run with docker-compose,
# The build2xlsform hostname is "odkbuild2xlsform" when run with docker-compose,
# not "localhost" (the default) as in a source install.
ENV B2X_HOST build2xlsform
ENV B2X_HOST odkbuild2xlsform
WORKDIR /srv/odkbuild/current

# Files
Expand Down
6 changes: 3 additions & 3 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ services:
POSTGRES_PASSWORD: odkbuild
POSTGRES_DATABASE: odkbuild
restart: always
build2xlsform:
image: "ghcr.io/getodk/odkbuild2xlsform:latest"
odkbuild2xlsform:
image: "ghcr.io/getodk/build2xlsform:latest"
ports:
- "8686:8686"
odkbuild:
Expand All @@ -23,7 +23,7 @@ services:
dockerfile: Dockerfile
depends_on:
- postgres
- build2xlsform
- odkbuild2xlsform
command: [ "./contrib/wait-for-it.sh", "postgres:5432", "--", "./start-odkbuild.sh" ]
ports:
- "9393:9393"
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ services:
POSTGRES_PASSWORD: odkbuild
POSTGRES_DATABASE: odkbuild
restart: always
build2xlsform:
image: "ghcr.io/getodk/odkbuild2xlsform:latest"
odkbuild2xlsform:
image: "ghcr.io/getodk/build2xlsform:latest"
ports:
- "8686:8686"
odkbuild:
image: ghcr.io/getodk/odkbuild:latest
image: "ghcr.io/getodk/build:latest"
depends_on:
- postgres
- build2xlsform
- odkbuild2xlsform
command: [ "./contrib/wait-for-it.sh", "postgres:5432", "--", "./start-odkbuild.sh" ]
ports:
- "9393:9393"
Expand Down

0 comments on commit 0c9dd11

Please sign in to comment.