Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/upstream/main' into yifan/sync-…
Browse files Browse the repository at this point in the history
…upstream
  • Loading branch information
yifanwu-kolena committed Feb 8, 2024
2 parents d658a08 + 2e12adb commit d252f9c
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 39 deletions.
11 changes: 11 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
NAME=sqitch
TITLE=Sqitch
VERSION=1.4.1
IMAGE=sqitch/sqitch
DESCRIPTION="Sensible database change management"
VENDOR="The Sqitch Community"
AUTHORS="Sqitch Hackers <sqitch-hackers@googlegroups.com>"
URL=https://hub.docker.com/r/sqitch/sqitch/
DOCS="https://github.com/sqitchers/docker-sqitch#readme"
SOURCE=https://github.com/sqitchers/docker-sqitch
LICENSE=MIT
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
# Install cpan and build dependencies.
ENV PERL5LIB /work/local/lib/perl5
RUN curl -sL --compressed https://git.io/cpm > cpm && chmod +x cpm \
&& ./cpm install -L local --verbose --no-test --show-build-log-on-failure ExtUtils::MakeMaker \
&& ./cpm install -L local --verbose --no-test --show-build-log-on-failure ExtUtils::MakeMaker List::MoreUtils::XS \
&& ./cpm install -L local --verbose --no-test --show-build-log-on-failure --with-recommends \
--with-configure --cpanfile src/dist/cpanfile

Expand All @@ -26,7 +26,9 @@ RUN perl Build.PL --quiet --install_base /app --etcdir /etc/sqitch \
--config installman1dir= --config installsiteman1dir= --config installman3dir= --config installsiteman3dir= \
--with sqlite --with postgres --with firebird --with odbc \
&& ln -s /usr/include/ibase.h /usr/include/firebird/ \
&& ./Build test && ./Build bundle \
# XXX Fix for removal of BEGIN block in v1.4.1.
&& perl -i -pe 's/BEGIN/use App::Sqitch/g' inc/Module/Build/Sqitch.pm \
&& ./Build bundle \
&& rm -rf /app/man \
&& find /app -name '*.pod' | grep -v sqitch | xargs rm -rf

Expand All @@ -37,11 +39,11 @@ FROM python:${PY_VERSION}-slim AS sqitch
# Install runtime system dependencies and remove unnecesary files.
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
&& apt-get -qq update \
&& apt-get -qq --no-install-recommends install less libperl5.32 perl-doc nano ca-certificates \
&& apt-get -qq --no-install-recommends install less libperl5.36 perl-doc nano ca-certificates \
sqlite3 \
firebird3.0-utils libfbclient2 \
libpq5 postgresql-client \
mariadb-client-core-10.5 libmariadb-dev-compat libdbd-mysql-perl \
mariadb-client-core libmariadb-dev-compat libdbd-mysql-perl \
&& apt-cache pkgnames | grep python | xargs apt-get purge -qq \
&& apt-cache pkgnames | grep libmagic | xargs apt-get purge -qq \
&& apt-get clean \
Expand All @@ -61,7 +63,8 @@ RUN apt-get update && apt-get install -y python3-pip curl git-lfs
RUN pip install poetry==1.2.2

# Copy the app and config from the build image.
COPY --from=sqitch-build /app .
COPY --from=sqitch-build /app/lib /lib
COPY --from=sqitch-build /app/bin /bin
COPY --from=sqitch-build /etc/sqitch /etc/sqitch/

# Set up environment, entrypoint, and default command.
Expand Down
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
.DEFAULT_GOAL := sqitch
.PHONY: oracle snowflake vertica exasol firebird postgres mysql sqlite

sqitch: Dockerfile
sqitch: Dockerfile .envrc
./build

# Oracle only on amd64 till an issue building DBD::Oracle is sorted.
# https://rt.cpan.org/Ticket/Display.html?id=149876
oracle: oracle/Dockerfile
env DIR=oracle REGISTRY=sqitch ./build
env DIR=oracle REGISTRY=sqitch ARCHS=amd64 ./build

# Snowflake only on amd64 till SnowSQL ARM support released.
# https://community.snowflake.com/s/question/0D5Do00000ltxpVKAQ/snowsql-linuxarm64-support
snowflake: snowflake/Dockerfile
env DIR=snowflake REGISTRY=sqitch ./build --build-arg sf_account=example
env DIR=snowflake REGISTRY=sqitch ARCHS=amd64 ./build --build-arg sf_account=example

# Exasol currently offers no ARM support.
exasol: exasol/Dockerfile
env DIR=exasol REGISTRY=sqitch ./build
env DIR=exasol REGISTRY=sqitch ARCHS=amd64 ./build
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ curl -L https://git.io/JJKCn -o sqitch && chmod +x sqitch

```bat
docker pull sqitch/sqitch
curl -L https://git.io/JTAi6 -o sqitch.bat
WebRequest -Uri "https://git.io/JTAi6" -OutFile "sqitch.bat"
.\sqitch help
```

Description
-----------

This project is the source for creating the official [Sqitch Project] Docker
Image. It's built on [stable Debian slim] in an effort to keep the image as
Image. It's built on [Debian bookworm-slim] in an effort to keep the image as
small as possible while supporting all known engines. It includes support for
managing [PostgreSQL], [CokroachDB], [YugabyteDB], [SQLite], [MariaDB]
managing [PostgreSQL], [CockroachDB], [YugabyteDB], [SQLite], [MariaDB]
([MySQL]), and [Firebird] databases, and other images may be built to support
for the other database engines that Sqitch supports.

Expand Down Expand Up @@ -82,9 +82,11 @@ Notes
for it to land). In the meantime you can [use a NAT gateway
container](https://github.com/qoomon/docker-host) to forward traffic to the
Docker host.
* Custom images for [Oracle], [Snowflake], [Exasol], or [Vertica] can be built
by downloading the appropriate binary files and using the `Dockerfile`s in
the appropriately-named subdirectories of this repository.
* Custom images for [Oracle], [Snowflake], or [Exasol] can be built by
downloading the appropriate binary files and using the `Dockerfile`s in the
appropriately-named subdirectories of this repository.
* The Sqitch image is built with AMD64 and ARM64 support, but the [Oracle],
[Snowflake] and [Exasol] images can currently only be built for AMD64.
* In an effort to keep things as simple as possible, the only editor included
and configured for use in the image is [nano]. This is a very simple, tiny
text editor suitable for editing change descriptions and the like. Its
Expand All @@ -93,7 +95,7 @@ Notes
one based on this image and add whatever editors you like.

[Sqitch Project]: https://sqitch.org
[stable Debian slim]: https://docs.docker.com/samples/library/debian/#debiansuite-slim
[Debian bookworm-slim]: https://hub.docker.com/_/debian/tags?name=bookworm-slim
[PostgreSQL]: https://postgresql.org
[YugabyteDB]: https://www.yugabyte.com/yugabytedb/
[CockroachDB]: https://www.cockroachlabs.com/product/
Expand All @@ -106,5 +108,4 @@ Notes
[Oracle]: https://www.oracle.com/database/
[Snowflake]:https://www.snowflake.com
[Exasol]:https://www.exasol.com/
[Vertica]: https://www.vertica.com
[nano]: https://www.nano-editor.org/
2 changes: 1 addition & 1 deletion docker-sqitch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ for var in \
TNS_ADMIN TWO_TASK ORACLE_SID \
ISC_USER ISC_PASSWORD \
VSQL_HOST VSQL_PORT VSQL_USER VSQL_PASSWORD VSQL_SSLMODE \
SNOWSQL_ACCOUNT SNOWSQL_USER SNOWSQL_PWD SNOWSQL_HOST SNOWSQL_PORT SNOWSQL_DATABASE SNOWSQL_REGION SNOWSQL_WAREHOUSE SNOWSQL_PRIVATE_KEY_PASSPHRASE
SNOWSQL_ACCOUNT SNOWSQL_USER SNOWSQL_PWD SNOWSQL_HOST SNOWSQL_PORT SNOWSQL_DATABASE SNOWSQL_REGION SNOWSQL_WAREHOUSE SNOWSQL_PRIVATE_KEY_PASSPHRASE SNOWSQL_ROLE
do
if [ -n "${!var}" ]; then
passopt+=(-e $var)
Expand Down
8 changes: 4 additions & 4 deletions exasol/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM debian:stable-slim AS exa-build
FROM --platform=linux/amd64 debian:bookworm-slim AS exa-build

WORKDIR /work

# Download and unpack EXAplus and the ODBC driver.
# COPY *.tar.gz ./
# https://downloads.exasol.com/clients-and-drivers
ARG version=7.1.19
ARG version=7.1.20
ADD https://x-up.s3.amazonaws.com/7.x/$version/EXAplus-$version.tar.gz \
https://x-up.s3.amazonaws.com/7.x/$version/EXASOL_ODBC-$version.tar.gz \
./
Expand All @@ -17,13 +17,13 @@ RUN tar zxf EXASOL_ODBC-$version.tar.gz \
&& mv EXAplus-$version/ exaplus \
&& rm -rf exaplus/doc

FROM sqitch/sqitch:latest
FROM --platform=linux/amd64 sqitch/sqitch:latest

# Install runtime dependencies, remove unnecesary files, and create symlink.
USER root
RUN apt-get -qq update \
&& mkdir -p /usr/share/man/man1 \
&& apt-get -qq --no-install-recommends install unixodbc openjdk-11-jre-headless \
&& apt-get -qq --no-install-recommends install unixodbc openjdk-17-jre-headless \
&& apt-get clean \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/* \
&& rm -rf /man /usr/share/man /usr/share/doc \
Expand Down
24 changes: 13 additions & 11 deletions oracle/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
FROM debian:stable-slim AS ora-build
FROM debian:bookworm-slim AS ora-build

WORKDIR /work
# https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
ARG INSTANTCLIENT_VERSION=21.9.0.0.0dbru
ARG INSTANTCLIENT_VDIR=219000

ADD https://download.oracle.com/otn_software/linux/instantclient/${INSTANTCLIENT_VDIR}/instantclient-basic-linux.x64-${INSTANTCLIENT_VERSION}.zip ./
ADD https://download.oracle.com/otn_software/linux/instantclient/${INSTANTCLIENT_VDIR}/instantclient-sqlplus-linux.x64-${INSTANTCLIENT_VERSION}.zip ./
ADD https://download.oracle.com/otn_software/linux/instantclient/${INSTANTCLIENT_VDIR}/instantclient-sdk-linux.x64-${INSTANTCLIENT_VERSION}.zip ./
# Alwyays install the latest version of instantclient.
# https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
# https://www.oracle.com/database/technologies/instant-client/linux-arm-aarch64-downloads.html

ENV BASEURI=https://download.oracle.com/otn_software/linux/instantclient/instantclient
ENV ORACLE_HOME /work/instantclient
ENV LD_LIBRARY_PATH /work/instantclient
ENV PERL5LIB /work/tmp/lib/perl5

RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
# Install dependen cies
# Install dependencies, including latest platform-specific instantclient.
&& apt-get -qq update \
&& apt-get -qq install build-essential libarchive-tools curl libaio-dev \
&& case "$(arch)" in aarch64) export ORAPLAT=-arm64 ;; x86_64) export ORAPLAT=x64 ;; esac \
&& curl "${BASEURI}-basic-linux${ORAPLAT}.zip" -o instantclient-basic.zip \
&& curl "${BASEURI}-sqlplus-linux${ORAPLAT}.zip" -o instantclient-sqlplus.zip \
&& curl "${BASEURI}-sdk-linux${ORAPLAT}.zip" -o instantclient-sdk.zip \
&& mkdir instantclient \
&& bsdtar -C instantclient --strip-components 1 -zxf instantclient-basic-linux.x64-${INSTANTCLIENT_VERSION}.zip \
&& bsdtar -C instantclient --strip-components 1 -zxf instantclient-sqlplus-linux.x64-${INSTANTCLIENT_VERSION}.zip \
&& bsdtar -C instantclient --strip-components 1 -zxf instantclient-basic.zip \
&& bsdtar -C instantclient --strip-components 1 -zxf instantclient-sqlplus.zip \
# Copy basic and SQL*Plus for installation below.
&& cp -rf instantclient instantclient.install \
&& bsdtar -C instantclient --strip-components 1 -zxf instantclient-sdk-linux.x64-${INSTANTCLIENT_VERSION}.zip \
&& bsdtar -C instantclient --strip-components 1 -zxf instantclient-sdk.zip \
# Install DBI in its own directory, then install DBD::Oracle.
&& curl https://cpanmin.us > cpanm && chmod +x cpanm \
&& ./cpanm install -l tmp --quiet --notest DBI \
Expand Down
17 changes: 11 additions & 6 deletions snowflake/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ FROM python:${PY_VERSION}-slim AS snow-build
WORKDIR /work

# Download the ODBC driver and SnowSQL.
# https://docs.snowflake.net/manuals/user-guide/snowsql-install-config.html#downloading-the-snowsql-installer
# https://docs.snowflake.net/manuals/release-notes/client-change-log-snowsql.html
# https://docs.snowflake.com/en/user-guide/snowsql-install-config
# https://docs.snowflake.com/en/release-notes/client-change-log-snowsql
# https://sfc-repo.snowflakecomputing.com/index.html
ADD https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/snowsql-1.2.25-linux_x86_64.bash snowsql.bash
ADD https://sfc-repo.snowflakecomputing.com/odbc/linux/2.25.10/snowflake_linux_x8664_odbc-2.25.10.tgz snowflake_linux_x8664_odbc.tgz
ENV ODBC_VERSION=3.1.0
# No ARM-specific SnowSQL yet.
# https://community.snowflake.com/s/question/0D5Do00000ltxpVKAQ/snowsql-linuxarm64-support
ADD https://sfc-repo.snowflakecomputing.com/snowsql/bootstrap/1.2/linux_x86_64/snowsql-1.2.28-linux_x86_64.bash snowsql.bash
COPY conf ./

# Tell SnowSQL where to store its versions and config. Need to keep it inside
Expand All @@ -23,11 +25,14 @@ ENV LC_ALL=C.UTF-8 LANG=C.UTF-8
# Install prereqs.
ARG sf_account
RUN apt-get -qq update \
&& apt-get -qq --no-install-recommends install odbcinst \
&& apt-get -qq --no-install-recommends install odbcinst curl ca-certificates \
# Configure ODBC. https://docs.snowflake.net/manuals/user-guide/odbc-linux.html
&& gunzip -f *.tgz && tar xf *.tar \
&& case "$(arch)" in aarch64) export SNOWPLAT=aarch64 DIRARCH=aarch64 ;; x86_64) export SNOWPLAT=x8664 ;; esac \
&& curl https://sfc-repo.snowflakecomputing.com/odbc/linux${DIRARCH}/${ODBC_VERSION}/snowflake_linux_${SNOWPLAT}_odbc-${ODBC_VERSION}.tgz -o snowflake_odbc.tgz \
&& gunzip -f *.tgz && tar vxf *.tar \
&& mkdir odbc \
&& mv snowflake_odbc/lib snowflake_odbc/ErrorMessages odbc/ \
&& perl -i -pe "s/x86_64/$(arch)/g" simba.snowflake.ini \
&& mv simba.snowflake.ini odbc/lib/ \
&& perl -i -pe "s/SF_ACCOUNT/$sf_account/g" odbc.ini \
&& cat odbc.ini >> /etc/odbc.ini \
Expand Down

0 comments on commit d252f9c

Please sign in to comment.