Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Stanza from a Maven pom.xml that creates an integration database from oracle/database docker image, adds a user and a tablespace through a sql file
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.15.16</version>
<configuration>
<images>
<image>
<name>enerko/ihldb</name>
<alias>ihl-integration-db</alias>
<build>
<from>oracle/database:12.1.0.2-ee</from>
<tags>
<tag>${project.version}</tag>
</tags>
<ports>
<port>1521</port>
<port>5500</port>
<port>5501</port>
</ports>
<assembly>
<inline xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<files>
<file>
<!-- contains something like -->
<!--
-- Change to PDB which was created inside parent iamge
ALTER SESSION SET CONTAINER = ORCLPDB1;
-- Enable Enterprise Manager Express on port 5501
EXEC dbms_xdb_config.sethttpsport(5501);
-- Create table space for demo application
CREATE SMALLFILE TABLESPACE "DOAG2016"
DATAFILE 'doag2016-1' SIZE 512M AUTOEXTEND ON NEXT 128M MAXSIZE 1024M
LOGGING
DEFAULT NOCOMPRESS
ONLINE
EXTENT MANAGEMENT LOCAL AUTOALLOCATE
SEGMENT SPACE MANAGEMENT AUTO;
-- Create doag2016 user
CREATE USER doag2016 IDENTIFIED BY doag2016 PROFILE "DEFAULT" ACCOUNT UNLOCK DEFAULT TABLESPACE "DOAG2016" TEMPORARY TABLESPACE "TEMP";
GRANT "CONNECT" TO doag2016;
GRANT "DBA" TO doag2016;
-->
<source>src/main/docker/ihldb/create_tablespace_and_user.sql</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
</inline>
</assembly>
<runCmds>
<runCmd>echo "startup;" | sqlplus / as sysdba</runCmd>
<runCmd>sqlplus / as sysdba @/maven/create_tablespace_and_user.sql</runCmd>
</runCmds>
<optimise>true</optimise>
</build>
<run>
<ports>
<port>ihl-integration-db:1521</port>
</ports>
<wait>
<log>Completed: ALTER DATABASE OPEN</log>
<time>300000</time>
</wait>
</run>
</image>
</images>
</configuration>
<executions>
<execution>
<id>prepare-it-database</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>remove-it-database</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment