Skip to content
Merged
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
52 changes: 51 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-container:
Expand All @@ -18,6 +17,9 @@ jobs:
contents: read
packages: write

env:
IMAGE_NAME: ${{ github.repository }}

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down Expand Up @@ -81,3 +83,51 @@ jobs:
env:
DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && '0' || '7' }}

build-postgres-container:
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

env:
IMAGE_NAME: ${{ github.repository }}-pgdb

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Log in to the Container registry
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Buildx
id: setup-buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1

- name: Extract metadata (tags, labels) for Container
id: meta
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}

- name: Build and push Docker images
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # 6.18.0
with:
context: .
file: internal/server/postgres/infra/Containerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
env:
DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && '0' || '7' }}

8 changes: 4 additions & 4 deletions examples/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ services:

api:
build:
context: api
context: ..
dockerfile: Containerfile
ports:
- "50051:50051"
Expand All @@ -27,8 +27,8 @@ services:

database:
build:
context: api/src/internal/repository/postgres/infra
dockerfile: Containerfile
context: ..
dockerfile: internal/server/postgres/infra/Containerfile
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Expand Down Expand Up @@ -75,5 +75,5 @@ configs:
lc_numeric = 'en_US.utf8' # locale for number formatting
lc_time = 'en_US.utf8' # locale for time formatting
default_text_search_config = 'pg_catalog.english'
shared_preload_libraries = 'pg_partman_bgw'
shared_preload_libraries = 'pg_cron'

4 changes: 2 additions & 2 deletions internal/server/postgres/dataserverimpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ func (s *DataPlatformDataServiceServerImpl) GetLatestForecasts(
ForecasterName: fc.ForecasterName,
ForecasterVersion: fc.ForecasterVersion,
},
LocationUuid: fc.GeometryUuid.String(),
Metadata: fc.Metadata,
LocationUuid: fc.GeometryUuid.String(),
Metadata: fc.Metadata,
CreatedTimestampUtc: timestamppb.New(fc.CreatedAtUtc.Time),
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/server/postgres/infra/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ RUN apt-get update \
&& apt-get install -y --no-install-recommends postgresql-18-cron \
&& rm -rf /var/lib/apt/lists/*

CMD [ "postgres","-c","shared_preload_libraries=pg_cron" ]
Loading