Skip to content

Commit 95f4f70

Browse files
committed
refactor: consolidated updates 2026-01-12
1 parent bcea44d commit 95f4f70

6 files changed

Lines changed: 222 additions & 147 deletions

File tree

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
jobs:
1212
# PostgreSQL 14 (quarterly packages)
1313
build-14:
14-
uses: daemonless/daemonless/.github/workflows/build-app.yml@main
14+
uses: daemonless/daemonless/.github/workflows/build-app.yaml@main
1515
with:
1616
image_name: postgres
1717
image_tag: "14"
@@ -21,7 +21,7 @@ jobs:
2121

2222
# PostgreSQL 14 (latest packages)
2323
build-14-pkg-latest:
24-
uses: daemonless/daemonless/.github/workflows/build-app.yml@main
24+
uses: daemonless/daemonless/.github/workflows/build-app.yaml@main
2525
with:
2626
image_name: postgres
2727
image_tag: "14-pkg-latest"
@@ -30,7 +30,7 @@ jobs:
3030

3131
# PostgreSQL 17 (quarterly packages)
3232
build-17:
33-
uses: daemonless/daemonless/.github/workflows/build-app.yml@main
33+
uses: daemonless/daemonless/.github/workflows/build-app.yaml@main
3434
with:
3535
image_name: postgres
3636
image_tag: "17"
@@ -40,7 +40,7 @@ jobs:
4040

4141
# PostgreSQL 17 (latest packages)
4242
build-17-pkg-latest:
43-
uses: daemonless/daemonless/.github/workflows/build-app.yml@main
43+
uses: daemonless/daemonless/.github/workflows/build-app.yaml@main
4444
with:
4545
image_name: postgres
4646
image_tag: "17-pkg-latest"
File renamed without changes.

Containerfile

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,25 @@ ARG PACKAGES="postgresql${PG_VERSION}-server postgresql${PG_VERSION}-client post
88
ARG UPSTREAM_URL="https://www.postgresql.org/docs/release/"
99
ARG HEALTHCHECK_ENDPOINT="pg_isready -q"
1010

11+
ENV HEALTHCHECK_URL="${HEALTHCHECK_ENDPOINT}"
12+
13+
# --- Metadata (Injected by Generator) ---
1114
LABEL org.opencontainers.image.title="PostgreSQL ${PG_VERSION}" \
12-
org.opencontainers.image.description="PostgreSQL ${PG_VERSION} on FreeBSD" \
13-
org.opencontainers.image.source="https://github.com/daemonless/postgres" \
14-
org.opencontainers.image.url="https://www.postgresql.org/" \
15-
org.opencontainers.image.documentation="https://www.postgresql.org/docs/${PG_VERSION}/" \
16-
org.opencontainers.image.licenses="PostgreSQL" \
17-
org.opencontainers.image.vendor="daemonless" \
18-
org.opencontainers.image.authors="daemonless" \
19-
io.daemonless.port="5432" \
20-
io.daemonless.arch="${FREEBSD_ARCH}" \
21-
io.daemonless.category="Databases" \
22-
io.daemonless.upstream-url="${UPSTREAM_URL}" \
23-
io.daemonless.packages="${PACKAGES}" \
24-
org.freebsd.jail.allow.sysvipc="required"
15+
org.opencontainers.image.description="The World's Most Advanced Open Source Relational Database on FreeBSD." \
16+
org.opencontainers.image.source="https://github.com/daemonless/postgres" \
17+
org.opencontainers.image.url="https://www.postgresql.org/" \
18+
org.opencontainers.image.documentation="https://www.postgresql.org/docs/${PG_VERSION}/" \
19+
org.opencontainers.image.licenses="PostgreSQL" \
20+
org.opencontainers.image.vendor="daemonless" \
21+
org.opencontainers.image.authors="daemonless" \
22+
io.daemonless.category="Databases" \
23+
io.daemonless.port="5432" \
24+
io.daemonless.volumes="/var/lib/postgresql/data" \
25+
org.freebsd.jail.allow.sysvipc="required" \
26+
io.daemonless.arch="${FREEBSD_ARCH}" \
27+
io.daemonless.pkg-source="containerfile" \
28+
io.daemonless.upstream-url="${UPSTREAM_URL}" \
29+
io.daemonless.packages="${PACKAGES}"
2530

2631
# Install PostgreSQL
2732
RUN pkg update && \
@@ -38,7 +43,7 @@ RUN mkdir -p /var/lib/postgresql/data /var/run/postgresql /run/secrets /docker-e
3843
COPY root/ /
3944

4045
# Make scripts executable
41-
RUN chmod +x /etc/services.d/*/run /etc/cont-init.d/* 2>/dev/null || true
46+
RUN chmod +x /etc/services.d/*/run /etc/cont-init.d/* /healthz 2>/dev/null || true
4247

4348
# Store PG version for scripts
4449
RUN mkdir -p /var/db/postgres && echo "${PG_VERSION}" > /var/db/postgres/pg_version
@@ -55,5 +60,8 @@ ENV PGDATA="/var/lib/postgresql/data" \
5560
POSTGRES_INITDB_ARGS="" \
5661
POSTGRES_HOST_AUTH_METHOD="scram-sha-256"
5762

63+
# --- Expose (Injected by Generator) ---
5864
EXPOSE 5432
59-
VOLUME /var/lib/postgresql/data
65+
66+
# --- Volumes (Injected by Generator) ---
67+
VOLUME /var/lib/postgresql/data

Containerfile.j2

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
ARG BASE_VERSION=15
2+
ARG PG_VERSION=17
3+
FROM ghcr.io/daemonless/base:${BASE_VERSION}
4+
ARG PG_VERSION
5+
6+
ARG FREEBSD_ARCH=amd64
7+
ARG PACKAGES="postgresql${PG_VERSION}-server postgresql${PG_VERSION}-client postgresql${PG_VERSION}-contrib"
8+
ARG UPSTREAM_URL="https://www.postgresql.org/docs/release/"
9+
ARG HEALTHCHECK_ENDPOINT="pg_isready -q"
10+
11+
ENV HEALTHCHECK_URL="${HEALTHCHECK_ENDPOINT}"
12+
13+
# --- Metadata (Injected by Generator) ---
14+
LABEL org.opencontainers.image.title="{{ title }} ${PG_VERSION}" \
15+
org.opencontainers.image.description="{{ description }}" \
16+
org.opencontainers.image.source="{{ repo_url }}" \
17+
org.opencontainers.image.url="{{ web_url }}" \
18+
org.opencontainers.image.documentation="https://www.postgresql.org/docs/${PG_VERSION}/" \
19+
org.opencontainers.image.licenses="PostgreSQL" \
20+
org.opencontainers.image.vendor="daemonless" \
21+
org.opencontainers.image.authors="daemonless" \
22+
io.daemonless.category="{{ category }}" \
23+
{%- if ports %}
24+
io.daemonless.port="{{ ports[0].port }}" \
25+
{%- endif %}
26+
{%- if volumes %}
27+
io.daemonless.volumes="{{ volumes | map(attribute='path') | join(',') }}" \
28+
{%- endif %}
29+
{%- if mlock %}
30+
org.freebsd.jail.allow.mlock="required" \
31+
{%- endif %}
32+
org.freebsd.jail.allow.sysvipc="required" \
33+
io.daemonless.arch="${FREEBSD_ARCH}" \
34+
io.daemonless.pkg-source="containerfile" \
35+
io.daemonless.upstream-url="${UPSTREAM_URL}" \
36+
io.daemonless.packages="${PACKAGES}"
37+
38+
# Install PostgreSQL
39+
RUN pkg update && \
40+
pkg install -y ${PACKAGES} && \
41+
pkg clean -ay && \
42+
rm -rf /var/cache/pkg/* /var/db/pkg/repos/*
43+
44+
# Create directories (use Linux-compatible paths for drop-in replacement)
45+
RUN mkdir -p /var/lib/postgresql/data /var/run/postgresql /run/secrets /docker-entrypoint-initdb.d && \
46+
chmod 755 /var/lib && \
47+
chown -R bsd:bsd /var/lib/postgresql /var/run/postgresql /run/secrets /docker-entrypoint-initdb.d
48+
49+
# Copy service definitions and init scripts
50+
COPY root/ /
51+
52+
# Make scripts executable
53+
RUN chmod +x /etc/services.d/*/run /etc/cont-init.d/* /healthz 2>/dev/null || true
54+
55+
# Store PG version for scripts
56+
RUN mkdir -p /var/db/postgres && echo "${PG_VERSION}" > /var/db/postgres/pg_version
57+
58+
# Extract package version for tagging (e.g., 17.7 or 14.20)
59+
RUN mkdir -p /app && \
60+
pkg query '%v' postgresql${PG_VERSION}-server | sed 's/_.*$//' > /app/version
61+
62+
ENV PGDATA="/var/lib/postgresql/data" \
63+
PG_VERSION="${PG_VERSION}" \
64+
POSTGRES_USER="postgres" \
65+
POSTGRES_PASSWORD="" \
66+
POSTGRES_DB="postgres" \
67+
POSTGRES_INITDB_ARGS="" \
68+
POSTGRES_HOST_AUTH_METHOD="scram-sha-256"
69+
70+
# --- Expose (Injected by Generator) ---
71+
{%- if ports %}
72+
EXPOSE {{ ports | map(attribute='port') | join(' ') }}
73+
{%- endif %}
74+
75+
# --- Volumes (Injected by Generator) ---
76+
{%- if volumes %}
77+
VOLUME {{ volumes | map(attribute='path') | join(' ') }}
78+
{%- endif %}

0 commit comments

Comments
 (0)