Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Publish to container registries #2

Open
wants to merge 6 commits into
base: kickoff
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on: push

permissions:
id-token: write
contents: write
issues: write
pull-requests: write
packages: write

env:
COMPOSE_EXPERIMENTAL_OCI_REMOTE: "1"
DOCKER_IMAGE_TAG: ${{ github.sha }}

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: |
wget https://github.com/docker/compose/releases/download/v2.30.3/docker-compose-linux-x86_64
mv docker-compose-linux-x86_64 compose-v2.30
chmod +x compose-v2.30
mv compose-v2.30 /usr/local/bin
- run: compose-v2.30 build --push
- run: compose-v2.30 alpha publish ghcr.io/withlogicco/postgres:${{ github.sha }}

config:
needs: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker info
- run: docker compose version
- run: docker compose config --no-normalize
- run: docker compose alpha viz --image --indentation-size=4 --networks --ports --spaces
3 changes: 3 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ x-base:
services:
primary:
<<: *base
image: ghcr.io/withlogicco/postgres/primary:${DOCKER_IMAGE_TAG:-latest}
build:
context: postgres
target: primary
Expand All @@ -19,6 +20,7 @@ services:

secondary:
<<: *base
image: ghcr.io/withlogicco/postgres/secondary:${DOCKER_IMAGE_TAG:-latest}
build:
context: postgres
target: secondary
Expand All @@ -27,6 +29,7 @@ services:
- secondary_data:/var/lib/postgresql/data

pgpool2:
image: ghcr.io/withlogicco/postgres/pgpool2:${DOCKER_IMAGE_TAG:-latest}
build:
context: pgpool2
secrets:
Expand Down
2 changes: 1 addition & 1 deletion pgpool2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04 as pgpool
FROM ubuntu:22.04 AS pgpool

# https://www.pgpool.net/mediawiki/index.php/Apt_Repository

Expand Down
10 changes: 5 additions & 5 deletions postgres/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
FROM postgres:16.2 as base
FROM postgres:16.2 AS base


FROM base as primary
FROM base AS primary

COPY ./postgres/primary/docker-entrypoint-initdb.d/ docker-entrypoint-initdb.d/
COPY ./primary/docker-entrypoint-initdb.d/ docker-entrypoint-initdb.d/


FROM base as secondary
FROM base AS secondary

COPY ./postgres/secondary/bin/ /usr/local/bin/
COPY ./secondary/bin/ /usr/local/bin/
ENTRYPOINT [ "docker-entrypoint-override.sh" ]

CMD ["postgres"]
Expand Down