diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..3ddb916 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/compose.yml b/compose.yml index 05dad22..034121f 100644 --- a/compose.yml +++ b/compose.yml @@ -11,6 +11,7 @@ x-base: services: primary: <<: *base + image: ghcr.io/withlogicco/postgres/primary:${DOCKER_IMAGE_TAG:-latest} build: context: postgres target: primary @@ -19,6 +20,7 @@ services: secondary: <<: *base + image: ghcr.io/withlogicco/postgres/secondary:${DOCKER_IMAGE_TAG:-latest} build: context: postgres target: secondary @@ -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: diff --git a/pgpool2/Dockerfile b/pgpool2/Dockerfile index f47c5ad..0cef110 100644 --- a/pgpool2/Dockerfile +++ b/pgpool2/Dockerfile @@ -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 diff --git a/postgres/Dockerfile b/postgres/Dockerfile index 01c6a91..659d9c6 100644 --- a/postgres/Dockerfile +++ b/postgres/Dockerfile @@ -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"]