How to optimize Dockerfile for Oracle?
I would like my Dockerfile to create image with Oracle and my database.
The image will be used for integration testing during the build.
So it should be small and fast.
The Dockerfile:
FROM valspace/oracle:18.4.0-xe
# Environment variables required for this build (do NOT change)
# -------------------------------------------------------------
ENV ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/18c/dbhomeXE
ORACLE_SID=XE
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
# download my.dmp
ARG USERNAME
ARG PASSWORD
RUN yum install curl
RUN curl -u "$USERNAME:$PASSWORD" https://myrepo/my.dmp -o /docker-entrypoint-initdb.d/my.dmp
RUN chmod a+rxw /docker-entrypoint-initdb.d/my.dmp
# copy initialization scripts
ADD init.sql /docker-entrypoint-initdb.d/
ADD script.sh /docker-entrypoint-initdb.d/
script.sh:
impdp system/oracle DUMPFILE=/docker-entrypoint-initdb.d/my.dmp
init.sql:
-- Creates:
-- tablespaces ...
-- users...
EXIT
Problems with the scripts:
- Files like .DMP, .SH, .SQL inside of final image.
- It creates image that imports DMP file on every start-up. Instead it should do it during the build-time.
- Is it possible to run Oracle in a minimal configuration?
Source: Docker Questions