Skip to content

Commit 164cc59

Browse files
author
qount25
committed
Add Dockerfile to build Debian images
1 parent d39f047 commit 164cc59

File tree

5 files changed

+54
-4
lines changed

5 files changed

+54
-4
lines changed

lib/pgpm/deb/Dockerfile

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# syntax = docker/dockerfile:experimental
2+
3+
# IMPORTANT: build it this way to allow for privileged execution
4+
#
5+
# Docker daemon config should have the entitlement
6+
# ```json
7+
# { "builder": {"Entitlements": {"security-insecure": true }} }
8+
# ```
9+
# ```
10+
# DOCKER_BUILDKIT=1 docker build --allow security.insecure -t IMAGE_NAME /path/to/pgpm
11+
# ```
12+
13+
# This Dockerfile is used to build a Debian image, which includes pbuilder and
14+
# pbuilder chroot image with basic dependendencies needed for building most
15+
# packages already pre-installed.
16+
17+
FROM docker.io/library/debian
18+
19+
MAINTAINER PGPM Debian Maintainer [email protected]
20+
21+
VOLUME /proc
22+
ARG DEBIAN_FRONTEND=noninteractive
23+
RUN apt update
24+
RUN apt install -y build-essential pbuilder fakeroot fakechroot
25+
RUN echo 'MIRRORSITE=http://deb.debian.org/debian' > /etc/pbuilderrc
26+
RUN echo 'AUTO_DEBSIGN=${AUTO_DEBSIGN:-no}' > /root/.pbuilderrc
27+
RUN echo 'HOOKDIR=/var/cache/pbuilder/hooks' >> /root/.pbuilderrc
28+
RUN --security=insecure pbuilder create # --components "main contrib-non-free"
29+
30+
COPY pbuilder_install_script.sh /root/pbuilder_install_script.sh
31+
RUN --security=insecure pbuilder execute --save-after-exec /root/pbuilder_install_script.sh

lib/pgpm/deb/builder.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def run_build
6161
# podman run options
6262
create_opts = " -v #{@pgpm_dir}:/root/pgpm"
6363
create_opts += ":z" if selinux_enabled?
64-
create_opts += " --privileged"
64+
create_opts += " --privileged --tmpfs /tmp" #--privileged --cap-add=sys_admin --security-opt label:disable -v /proc:/proc
6565
create_opts += " --name #{@container_name} #{image_name}"
6666

6767
dsc_fn = "#{@spec.package.name}-#{@spec.package.version.to_s}_0-1.dsc"
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
apt update
3+
DEBIAN_FRONTEND=noninteractive apt -y install build-essential curl lsb-release ca-certificates
4+
5+
### PostgreSQL installation
6+
#
7+
install -d /usr/share/postgresql-common/pgdg
8+
curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
9+
10+
# Create the repository configuration file:
11+
sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
12+
13+
# Update the package lists:
14+
apt update
15+
16+
# Install the latest version of PostgreSQL:
17+
# If you want a specific version, use 'postgresql-16' or similar instead of 'postgresql'
18+
apt -y install postgresql-17 postgresql-server-dev-17 postgresql-common
19+
#
20+
### END OF PostgreSQL installation
21+

lib/pgpm/deb/templates/changelog.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
* Version <%= source_version %> package release.
44

5-
-- PGPM Debian maintainer <debian.maintainer@postgres.pm> <%= Time.now.to_s %>
5+
-- PGPM Debian maintainer <debian.maintainer@pgpm.org> <%= Time.now.strftime('%a, %d %b %Y %H:%M:%S %z')%>

lib/pgpm/package/dependencies.rb

-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ def build_dependencies
1010
case @os
1111
when "debian", "ubuntu"
1212
[
13-
"postgresql-#{postgres_major_version}",
1413
"build-essential",
1514
"postgresql-#{postgres_major_version}",
1615
"postgresql-server-dev-#{postgres_major_version}",
1716
"postgresql-common"
1817
]
1918
when "rocky", "redhat", "fedora"
2019
[
21-
"postgresql-#{postgres_major_version}",
2220
"build-essential",
2321
"postgresql-#{postgres_major_version}",
2422
"postgresql-server-devel-#{postgres_major_version}",

0 commit comments

Comments
 (0)