Skip to content

Support multi arch #13

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

Merged
merged 76 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
218da1d
Add support for multi-architecture in Dockerfile
Chris-godz Aug 9, 2024
c7ec227
Add support for multi-architecture in Dockerfile
Chris-godz Aug 9, 2024
8c8b053
Clean workspace
Chris-godz Aug 9, 2024
6b0497a
repush
Chris-godz Aug 9, 2024
ee59cf4
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
ca7ffe4
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
a65d913
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
3e94789
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
a5ca03a
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
82ff94c
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
9eb6e12
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
c17deb3
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
cbcc8bf
modify generate-stackbrew-library.sh
Chris-godz Aug 9, 2024
eb0e320
Add support for multi-architecture in Dockerfile
Chris-godz Aug 9, 2024
a20aaac
Add support for multi-architecture in Dockerfile
Chris-godz Aug 9, 2024
91f6dfd
fix version.json
Chris-godz Aug 9, 2024
bd109ca
Add support for multi-architecture in Dockerfile
Chris-godz Aug 9, 2024
983d9be
Add support for multi-architecture in Dockerfile
Chris-godz Aug 9, 2024
7c3ff4d
Add support for multi-architecture in Dockerfile
Chris-godz Aug 9, 2024
26df097
Add support for multi-architecture in Dockerfile
Chris-godz Aug 9, 2024
d93c901
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
b5ae473
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
6ae0ef6
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
f1d9c82
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
35ba2b4
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
2cebd83
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
a801559
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
06ef2a3
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
f5c135e
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
6070826
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
589fcbb
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
b87cb78
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
e546875
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
88c23e6
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
61eaabe
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
4628323
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
dcf1360
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
dde320a
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
c813e3b
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
53cd6a9
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
9879233
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
54ecc84
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
18d8be4
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
b313ab1
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
0d6cac4
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
927dfd2
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
e031a34
Add support for multi-architecture in Dockerfile
Chris-godz Aug 10, 2024
f7e0ad6
Update ci.yml
Chris-godz Aug 10, 2024
8c1843d
Update generate-stackbrew-library.sh
Chris-godz Aug 10, 2024
0655004
Update generate-stackbrew-library.sh
Chris-godz Aug 10, 2024
2902c32
Update generate-stackbrew-library.sh
Chris-godz Aug 10, 2024
a347317
Update generate-stackbrew-library.sh
Chris-godz Aug 10, 2024
95ad641
Update generate-stackbrew-library.sh
Chris-godz Aug 10, 2024
63d19bb
Update Dockerfile
Chris-godz Aug 10, 2024
897cfdf
Update generate-stackbrew-library.sh
Chris-godz Aug 10, 2024
a9469ff
Update munge.sh
Chris-godz Aug 17, 2024
b02ccce
Update Dockerfile
Chris-godz Aug 17, 2024
a169192
Update generate-stackbrew-library.sh
Chris-godz Aug 17, 2024
b8e5128
Support multi-arch
Chris-godz Sep 2, 2024
3476081
add bookworm feature
Chris-godz Sep 2, 2024
785251f
add bookworm feature
Chris-godz Sep 2, 2024
e5bd196
Create ubi8
Chris-godz Sep 2, 2024
743a8fa
add bookworm feature
Chris-godz Sep 2, 2024
d5efe6a
add bookworm feature
Chris-godz Sep 2, 2024
767be87
add bookworm feature
Chris-godz Sep 2, 2024
39def4f
Update verify-templating.yml
Chris-godz Sep 2, 2024
3b3e2e4
add bookworm feature
Chris-godz Sep 2, 2024
4218be8
Merge branch 'feature/support-multi-arch' of https://github.com/Chris…
Chris-godz Sep 2, 2024
618dfea
add bookworm feature
Chris-godz Sep 2, 2024
6ffbbfd
Update verify-templating.yml
Chris-godz Sep 2, 2024
8d35104
Ensure entrypoint is executable.
Chris-godz Sep 2, 2024
135d929
Update verify-templating.yml
Chris-godz Sep 2, 2024
3e0f9f0
Update verify-templating.yml
Chris-godz Sep 2, 2024
997bccb
Update Dockerfile-redhat.template
Chris-godz Sep 2, 2024
ef35f44
support multi atch
Chris-godz Sep 2, 2024
4a69657
Update verify-templating.yml
Chris-godz Sep 2, 2024
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
168 changes: 168 additions & 0 deletions 3/bookworm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

# Use Debian as the base image
FROM debian:bookworm-slim as builder

# explicitly set user/group IDs
RUN groupadd -g 1000 ivorysql; \
useradd -u 1000 -g ivorysql -d /var/local/ivorysql -s /bin/sh ivorysql; \
mkdir -p /var/local/ivorysql; \
mkdir -p /usr/src/ivorysql; \
mkdir -p /var/lib/ivorysql; \
chown -R ivorysql:ivorysql /var/local/ivorysql; \
chown -R ivorysql:ivorysql /usr/src/ivorysql; \
chown -R ivorysql:ivorysql /var/lib/ivorysql

RUN mkdir /docker-entrypoint-initdb.d

# Set environment variables for IvorySQL
ENV IVORY_MAJOR 3
ENV IVORY_VERSION 3.3
ARG USE_CHINA_MIRROR=false

# Use China mirror if specified
RUN if [ "$USE_CHINA_MIRROR" = "true" ]; then \
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources ;\
fi

# Update package list and install necessary dependencies
RUN apt-get update
RUN apt-get install -y make \
libreadline-dev \
zlib1g-dev \
libssl-dev \
flex \
wget \
dpkg \
build-essential \
llvm \
llvm-dev \
liblz4-dev \
clang \
libkrb5-dev \
libselinux1-dev \
libxml2-dev \
libsasl2-dev \
libicu-dev \
e2fslibs-dev \
libsepol-dev \
libsystemd-dev \
libxslt1-dev \
libldap2-dev \
libssl-dev \
libpam0g-dev \
uuid-dev \
python3-dev \
libreadline-dev \
tcl-dev \
zlib1g-dev \
perl \
libperl-dev \
perl \
perl-base \
perl-modules \
perl-doc \
m4 \
libc6 \
libbison-dev\
libossp-uuid-dev\
curl

RUN wget https://mirrors.ustc.edu.cn/gnu/bison/bison-3.0.4.tar.gz; \
tar -xzvf bison-3.0.4.tar.gz; \
cd bison-3.0.4 ; \
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c ;\
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h ;\
mkdir build && cd build ;\
../configure ;\
make && make install ;

RUN wget -O ivorysql.tar.gz "https://github.com/IvorySQL/IvorySQL/archive/refs/tags/IvorySQL_$IVORY_VERSION.tar.gz"; \
tar \
--extract \
--file ivorysql.tar.gz \
--directory /usr/src/ivorysql \
--strip-components 1 \
; \
rm ivorysql.tar.gz; \
cd /usr/src/ivorysql; \
./configure \
--prefix=/var/local/ivorysql/ivorysql-$IVORY_MAJOR \
--enable-cassert --enable-debug --enable-rpath --with-tcl \
--with-python --with-gssapi --with-pam --with-ldap \
--with-openssl --with-libedit-preferred --with-uuid=e2fs \
--with-ossp-uuid --with-libxml --with-libxslt --with-perl \
--without-icu \
;\
make && make install;

RUN rm -rf \
/usr/src/ivorysql \
/usr/local/share/doc \
/usr/local/share/man

RUN chown -R ivorysql:ivorysql /var/local/ivorysql/ivorysql-$IVORY_MAJOR
RUN dpkgArch="$(dpkg --print-architecture)"; # amd64 | arm64v8
RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.11/gosu-$dpkgArch"

RUN chmod +x /usr/local/bin/gosu

FROM debian:bookworm-slim

COPY --from=builder /var/local/ivorysql /var/local/ivorysql/
COPY --from=builder /usr/local/bin/gosu /usr/local/bin/gosu

ENV IVORY_MAJOR 3
ENV IVORY_VERSION 3.3
ARG USE_CHINA_MIRROR=false
RUN mkdir /docker-entrypoint-initdb.d

RUN useradd -u 1000 ivorysql

# Use China mirror if specified
RUN if [ "$USE_CHINA_MIRROR" = "true" ]; then \
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources ;\
fi

RUN apt-get update && \
apt-get install -y \
liblz4-1 \
liblz4-dev \
libkrb5-dev \
libxslt1-dev \
libldap-common \
libldap-2.5-0 \
libldap2-dev \
libreadline-dev \
libicu-dev && \
apt-get clean


RUN chown -R ivorysql:ivorysql /var/local/ivorysql
RUN chown -R ivorysql:ivorysql /usr/local/bin

ENV PGDATA /var/local/ivorysql/ivorysql-$IVORY_MAJOR/data

# this 1777 will be replaced by 0700 at runtime (allows semi-arbitrary "--user" values)
RUN mkdir -p "$PGDATA" && chown -R ivorysql:ivorysql "$PGDATA" && chmod 1777 "$PGDATA"
RUN mkdir -p /var/run/postgresql && chown -R ivorysql:ivorysql /var/run/postgresql && chmod 3777 /var/run/postgresql

VOLUME ["/var/local/ivorysql/ivorysql-$IVORY_MAJOR/data","/var/local/ivorysql/data"]

ENV PATH $PATH:/var/local/ivorysql/ivorysql-$IVORY_MAJOR/bin

COPY docker-entrypoint.sh docker-ensure-initdb.sh /usr/local/bin/
RUN ln -sT docker-ensure-initdb.sh /usr/local/bin/docker-enforce-initdb.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

ENTRYPOINT ["docker-entrypoint.sh"]

STOPSIGNAL SIGINT

EXPOSE 5432 5866 1521

CMD ["postgres"]
71 changes: 71 additions & 0 deletions 3/bookworm/docker-ensure-initdb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash
set -Eeuo pipefail

#
# This script is intended for three main use cases:
#
# 1. (most importantly) as an example of how to use "docker-entrypoint.sh" to extend/reuse the initialization behavior
#
# 2. ("docker-ensure-initdb.sh") as a Kubernetes "init container" to ensure the provided database directory is initialized; see also "startup probes" for an alternative solution
# (no-op if database is already initialized)
#
# 3. ("docker-enforce-initdb.sh") as part of CI to ensure the database is fully initialized before use
# (error if database is already initialized)
#

source /usr/local/bin/docker-entrypoint.sh

# arguments to this script are assumed to be arguments to the "postgres" server (same as "docker-entrypoint.sh"), and most "docker-entrypoint.sh" functions assume "postgres" is the first argument (see "_main" over there)
if [ "$#" -eq 0 ] || [ "$1" != 'postgres' ]; then
set -- postgres "$@"
fi

# see also "_main" in "docker-entrypoint.sh"

docker_setup_env
# setup data directories and permissions (when run as root)
docker_create_db_directories
if [ "$(id -u)" = '0' ]; then
# then restart script as postgres user
exec su-exec postgres "$BASH_SOURCE" "$@"
fi

# only run initialization on an empty data directory
if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
docker_verify_minimum_env

# check dir permissions to reduce likelihood of half-initialized database
ls /docker-entrypoint-initdb.d/ > /dev/null

docker_init_database_dir
pg_setup_hba_conf "$@"

# PGPASSWORD is required for psql when authentication is required for 'local' connections via pg_hba.conf and is otherwise harmless
# e.g. when '--auth=md5' or '--auth-local=md5' is used in POSTGRES_INITDB_ARGS
export PGPASSWORD="${PGPASSWORD:-$POSTGRES_PASSWORD}"
docker_temp_server_start "$@"

docker_setup_db
docker_process_init_files /docker-entrypoint-initdb.d/*

docker_temp_server_stop
unset PGPASSWORD
else
self="$(basename "$0")"
case "$self" in
docker-ensure-initdb.sh)
echo >&2 "$self: note: database already initialized in '$PGDATA'!"
exit 0
;;

docker-enforce-initdb.sh)
echo >&2 "$self: error: (unexpected) database found in '$PGDATA'!"
exit 1
;;

*)
echo >&2 "$self: error: unknown file name: $self"
exit 99
;;
esac
fi
Loading
Loading