Skip to content

Commit 0b6485e

Browse files
committed
Merge pull request wnameless#11 from fbe/improve-buildsetup-and-scripts
Add assets folder and setup.sh & statup.sh
2 parents e42969b + 0114d0d commit 0b6485e

9 files changed

+57
-40
lines changed

Dockerfile

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,11 @@ FROM ubuntu:14.04.1
22

33
MAINTAINER Wei-Ming Wu <[email protected]>
44

5-
ADD chkconfig /sbin/chkconfig
6-
ADD init.ora /
7-
ADD initXETemp.ora /
8-
ADD oracle-xe_11.2.0-1.0_amd64.debaa /
9-
ADD oracle-xe_11.2.0-1.0_amd64.debab /
10-
ADD oracle-xe_11.2.0-1.0_amd64.debac /
11-
# ADD oracle-xe_11.2.0-1.0_amd64.deb /
12-
RUN cat /oracle-xe_11.2.0-1.0_amd64.deba* > /oracle-xe_11.2.0-1.0_amd64.deb
13-
14-
# Install sshd
15-
RUN apt-get install -y openssh-server
16-
RUN mkdir /var/run/sshd
17-
RUN echo 'root:admin' | chpasswd
18-
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
19-
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
20-
RUN echo "export VISIBLE=now" >> /etc/profile
21-
22-
# Prepare to install Oracle
23-
RUN apt-get install -y libaio1 net-tools bc
24-
RUN ln -s /usr/bin/awk /bin/awk
25-
RUN mkdir /var/lock/subsys
26-
RUN chmod 755 /sbin/chkconfig
27-
28-
# Install Oracle
29-
RUN dpkg --install /oracle-xe_11.2.0-1.0_amd64.deb
30-
31-
RUN mv /init.ora /u01/app/oracle/product/11.2.0/xe/config/scripts
32-
RUN mv /initXETemp.ora /u01/app/oracle/product/11.2.0/xe/config/scripts
33-
34-
RUN printf 8080\\n1521\\noracle\\noracle\\ny\\n | /etc/init.d/oracle-xe configure
35-
36-
RUN echo 'export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe' >> /etc/bash.bashrc
37-
RUN echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /etc/bash.bashrc
38-
RUN echo 'export ORACLE_SID=XE' >> /etc/bash.bashrc
39-
40-
# Remove installation files
41-
RUN rm /oracle-xe_11.2.0-1.0_amd64.deb*
5+
ADD assets /assets
6+
RUN /assets/setup.sh
427

438
EXPOSE 22
449
EXPOSE 1521
4510
EXPOSE 8080
4611

47-
CMD sed -i -E "s/HOST = [^)]+/HOST = $HOSTNAME/g" /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora; \
48-
service oracle-xe start; \
49-
/usr/sbin/sshd -D
12+
CMD /usr/sbin/startup.sh && /usr/sbin/sshd -D
File renamed without changes.
File renamed without changes.
File renamed without changes.

assets/setup.sh

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
# avoid dpkg frontend dialog / frontend warnings
4+
export DEBIAN_FRONTEND=noninteractive
5+
6+
cat /assets/oracle-xe_11.2.0-1.0_amd64.deba* > /assets/oracle-xe_11.2.0-1.0_amd64.deb
7+
8+
# Install OpenSSH
9+
apt-get install -y openssh-server &&
10+
mkdir /var/run/sshd &&
11+
echo 'root:admin' | chpasswd &&
12+
sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config &&
13+
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd &&
14+
echo "export VISIBLE=now" >> /etc/profile &&
15+
16+
# Prepare to install Oracle
17+
apt-get install -y libaio1 net-tools bc &&
18+
ln -s /usr/bin/awk /bin/awk &&
19+
mkdir /var/lock/subsys &&
20+
mv /assets/chkconfig /sbin/chkconfig &&
21+
chmod 755 /sbin/chkconfig &&
22+
23+
# Install Oracle
24+
dpkg --install /assets/oracle-xe_11.2.0-1.0_amd64.deb &&
25+
26+
# Backup listener.ora as template
27+
cp /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora.tmpl &&
28+
29+
mv /assets/init.ora /u01/app/oracle/product/11.2.0/xe/config/scripts &&
30+
mv /assets/initXETemp.ora /u01/app/oracle/product/11.2.0/xe/config/scripts &&
31+
32+
printf 8080\\n1521\\noracle\\noracle\\ny\\n | /etc/init.d/oracle-xe configure &&
33+
34+
echo 'export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe' >> /etc/bash.bashrc &&
35+
echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /etc/bash.bashrc &&
36+
echo 'export ORACLE_SID=XE' >> /etc/bash.bashrc &&
37+
38+
# Install startup script for container
39+
mv /assets/startup.sh /usr/sbin/startup.sh &&
40+
chmod +x /usr/sbin/startup.sh &&
41+
42+
# Remove installation files
43+
rm -r /assets/
44+
45+
46+
exit $?

assets/startup.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
LISTENERS_ORA=/u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora
3+
4+
cp "${LISTENERS_ORA}.tmpl" "$LISTENERS_ORA" &&
5+
sed -i "s/%hostname%/$HOSTNAME/g" "${LISTENERS_ORA}" &&
6+
sed -i "s/%port%/1521/g" "${LISTENERS_ORA}" &&
7+
8+
service oracle-xe start

0 commit comments

Comments
 (0)