Skip to content
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

Container file simplication #569

Merged
merged 3 commits into from
Jul 11, 2023
Merged

Conversation

grooverdan
Copy link
Contributor

To reduce the duplication and minimize the image size, base/Dockerfile was created to capture the common elements of the base image.

The database specific files derive from this base image.

The top level Dockerfile uses the mssql, the more complicated image as a base, and using multistage images takes the important aspects out of oracle's image, and does the package installs for maria, mysql and postgres.

A number of changes in the base image where made:

  • Apt-sources weren't used so leave them disabled.
  • apt doesn't provide a stable command line interfaces, so use apt-get
  • to reduce image size, /var/lib/apt/lists/* is removed
  • DEBIAN_FRONTEND=noninteractive is an environment variable rather than a build arg.

@grooverdan grooverdan requested a review from a team as a code owner June 21, 2023 01:49
@sm-shaw sm-shaw added the docker docker file and image related label Jun 21, 2023
@pooja-jain-17
Copy link
Collaborator

Thank you! I went through the pull request and almost everything works perfectly, except for some minor typos.

HammerDB/Docker/mssqls/Dockerfile – “install” is missing
DEBIAN_FRONTEND=noninteractive apt-get install -y curl gcc make lsb-release && \

HammerDB/Docker/oracle/Dockerfile
Base image sets the working directory as /home/hammerdb/HammerDB-4.7 at the end, so when creating a database specific client image, working directory needs to be reset as as /home/hammerdb for Oracle instant client installation, and back to /home/hammerdb/HammerDB-4.7

FROM docker.io/tpcorg/hammerdb:base

WORKDIR /home/hammerdb

# Install and configure Oracle client libraries
RUN wget https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-basic-linux.x64-21.5.0.0.0dbru.zip && \
    unzip *.zip && \
    echo 'export LD_LIBRARY_PATH=/home/hammerdb/instantclient_21_5/:$LD_LIBRARY_PATH'  >> ~/.bashrc && \
    rm *.zip

ENV ORACLE_LIBRARY=/home/hammerdb/instantclient_21_5/libclntsh.so

WORKDIR /home/hammerdb/HammerDB-4.7

OR

need to specify the folder "/home/hammerdb/" to download and extract the oracle instantclient

FROM docker.io/tpcorg/hammerdb:base

# Install and configure Oracle client libraries
RUN wget https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-basic-linux.x64-21.5.0.0.0dbru.zip -P /home/hammerdb/ && \
    unzip /home/hammerdb/*.zip -d /home/hammerdb/ && \
    echo 'export LD_LIBRARY_PATH=/home/hammerdb/instantclient_21_5/:$LD_LIBRARY_PATH'  >> ~/.bashrc && \
    rm /home/hammerdb/*.zip

ENV ORACLE_LIBRARY=/home/hammerdb/instantclient_21_5/libclntsh.so

@pooja-jain-17
Copy link
Collaborator

on second thoughts, Since HammerDB version is added as an argument variable in base/Dockerfile, it's best to create the WORKDIR directory using that, like below. Therefore, specifying the folder "/home/hammerdb/" to download and extract the oracle instantclient will be better.

HammerDB/Docker/base/Dockerfile

# Install configure HammerDB-v4.7
ARG HAMMERDB_VERSION=4.8
RUN mkdir /home/hammerdb && \
    wget https://github.com/TPC-Council/HammerDB/releases/download/v$HAMMERDB_VERSION/HammerDB-$HAMMERDB_VERSION-Linux.tar.gz -O - | \
        tar -xvzf - -C /home/hammerdb

WORKDIR /home/hammerdb/HammerDB-$HAMMERDB_VERSION

HammerDB/Docker/oracle/Dockerfile

FROM docker.io/tpcorg/hammerdb:base

# Install and configure Oracle client libraries
RUN wget https://download.oracle.com/otn_software/linux/instantclient/215000/instantclient-basic-linux.x64-21.5.0.0.0dbru.zip -P /home/hammerdb/ && \
    unzip /home/hammerdb/*.zip -d /home/hammerdb/ && \
    echo 'export LD_LIBRARY_PATH=/home/hammerdb/instantclient_21_5/:$LD_LIBRARY_PATH'  >> ~/.bashrc && \
    rm /home/hammerdb/*.zip

ENV ORACLE_LIBRARY=/home/hammerdb/instantclient_21_5/libclntsh.so

@grooverdan
Copy link
Contributor Author

What do you think about leaving /home/hammerdb as the final location (without a version), so that all releases look the same inside the container? (tar --strip-components=1 in the extract).

@pooja-jain-17
Copy link
Collaborator

Having the directory with version would make it explicit to know what HammerDB version is being used. It will inhibit benchmark comparison between different versions of HammerDB.

Consistency can achieved by adding a symbolic link for /home/hammerdb -> /home /HammerDB-4.7 and placing all other libraries like Oracle instantclient in /home.

ARG HAMMERDB_VERSION=4.7

RUN wget https://github.com/TPC-Council/HammerDB/releases/download/v$HAMMERDB_VERSION/HammerDB-$HAMMERDB_VERSION-Linux.tar.gz -O - | \
       tar -xvzf - -C /home/

RUN ln -s /home/HammerDB-$HAMMERDB_VERSION /home/hammerdb

WORKDIR /home/hammerdb

@grooverdan
Copy link
Contributor Author

ok. Will incorporate and include these changes now.

During the build annotations are a way to include version information too:
https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys

To reduce the duplication and minimize the image size, base/Dockerfile
was created to capture the common elements of the base image.

The database specific files derive from this base image.

The top level Dockerfile uses the mssql, the more complicated image
as a base, and using multistage images takes the important aspects out
of oracle's image, and does the package installs for maria, mysql and
postgres.

A number of changes in the base image where made:
* Apt-sources weren't used so leave them disabled.
* apt doesn't provide a stable command line interfaces, so use apt-get
* to reduce image size,  /var/lib/apt/lists/* is removed
* DEBIAN_FRONTEND=noninteractive is an environment variable rather than
  a build arg.
@pooja-jain-17
Copy link
Collaborator

Many-thanks. Appreciate it.

@jamiere-msft jamiere-msft self-requested a review July 5, 2023 18:16
@abondvt89 abondvt89 merged commit 8ad6b64 into TPC-Council:master Jul 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker docker file and image related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants