Build Java Docker Image from Ubuntu: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 12: | Line 12: | ||
CMD /usr/sbin/startup.sh && | CMD /usr/sbin/startup.sh && | ||
/usr/sbin/sshd -D | /usr/sbin/sshd -D | ||
</syntaxhighlight> | |||
== Setup Script == | |||
<syntaxhighlight lang="docker"> | |||
#!/bin/bash | |||
: ' | |||
@author "Chorke, Inc."<[email protected]> | |||
@web http://chorke.org | |||
@vendor Chorke, Inc. | |||
@version 0.0.00 | |||
@since 0.0.00 | |||
' | |||
# apt-get in not interactive mode | |||
export DEBIAN_FRONTEND=noninteractive | |||
# install openssh | |||
apt-get update && | |||
apt-get install -y openssh-server && | |||
apt-get install -y openssh-client && | |||
mkdir /var/run/sshd && | |||
echo 'root:admin' | chpasswd && | |||
sed -i 's/^PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config && | |||
sed -i 's/session\s*required\s*pam_loginuid.so/session optional pam_loginuid.so/g' /etc/pam.d/sshd && | |||
echo 'export VISIBLE=now' >> /etc/profile && | |||
# env for chorke workspaces and application | |||
echo 'export CKI_WORKSPACES=/chorke/dev/jee/cki_workspaces' >> /etc/bash.bashrc && | |||
echo 'export EBIS_HOME=/chorke/pro/ebis' >> /etc/bash.bashrc && | |||
echo 'export PATH=$EBIS_HOME/bin:$PATH' >> /etc/bash.bashrc && | |||
# install startup script for container | |||
mv /assets/startup.sh /usr/sbin/startup.sh && | |||
chmod +x /usr/sbin/startup.sh && | |||
# create file if not exists | |||
# mkdir -p $CKI_WORKSPACES && | |||
# mkdir -p $EBIS_HOME && | |||
# remove installation files | |||
rm -r /assets/ | |||
exit $? | |||
</syntaxhighlight> | |||
== Startup Script == | |||
<syntaxhighlight lang="docker"> | |||
#!/bin/bash | |||
: ' | |||
@author "Chorke, Inc."<[email protected]> | |||
@web http://chorke.org | |||
@vendor Chorke, Inc. | |||
@version 0.0.00 | |||
@since 0.0.00 | |||
' | |||
# env for chorke workspaces and application | |||
export CKI_WORKSPACES=/chorke/dev/jee/cki_workspaces && | |||
export EBIS_HOME=/chorke/pro/ebis && | |||
export PATH=$EBIS_HOME/bin:$PATH | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 12:42, 27 January 2018
Dockerfile
FROM ubuntu:16.04
MAINTAINER Chorke, Inc.<[email protected]>
ADD assets /assets
RUN /assets/setup.sh
EXPOSE 22
EXPOSE 8080
CMD /usr/sbin/startup.sh &&
/usr/sbin/sshd -D
Setup Script
#!/bin/bash
: '
@author "Chorke, Inc."<[email protected]>
@web http://chorke.org
@vendor Chorke, Inc.
@version 0.0.00
@since 0.0.00
'
# apt-get in not interactive mode
export DEBIAN_FRONTEND=noninteractive
# install openssh
apt-get update &&
apt-get install -y openssh-server &&
apt-get install -y openssh-client &&
mkdir /var/run/sshd &&
echo 'root:admin' | chpasswd &&
sed -i 's/^PermitRootLogin .*/PermitRootLogin yes/' /etc/ssh/sshd_config &&
sed -i 's/session\s*required\s*pam_loginuid.so/session optional pam_loginuid.so/g' /etc/pam.d/sshd &&
echo 'export VISIBLE=now' >> /etc/profile &&
# env for chorke workspaces and application
echo 'export CKI_WORKSPACES=/chorke/dev/jee/cki_workspaces' >> /etc/bash.bashrc &&
echo 'export EBIS_HOME=/chorke/pro/ebis' >> /etc/bash.bashrc &&
echo 'export PATH=$EBIS_HOME/bin:$PATH' >> /etc/bash.bashrc &&
# install startup script for container
mv /assets/startup.sh /usr/sbin/startup.sh &&
chmod +x /usr/sbin/startup.sh &&
# create file if not exists
# mkdir -p $CKI_WORKSPACES &&
# mkdir -p $EBIS_HOME &&
# remove installation files
rm -r /assets/
exit $?
Startup Script
#!/bin/bash
: '
@author "Chorke, Inc."<[email protected]>
@web http://chorke.org
@vendor Chorke, Inc.
@version 0.0.00
@since 0.0.00
'
# env for chorke workspaces and application
export CKI_WORKSPACES=/chorke/dev/jee/cki_workspaces &&
export EBIS_HOME=/chorke/pro/ebis &&
export PATH=$EBIS_HOME/bin:$PATH
Good to Know
docker build -t 'chorke/ebis' -f ./Dockerfile ./
docker run --name='initd' -d -p 2223:22 -p 8080:80 chorke/ebis
docker rm initd && docker rmi chorke/ebis
docker history chorke/ebis
service status ssh
service --status-all
printenv
apt -y install git
apt -y install openjdk-8-jdk
apt -y install zip
wget http://cdn.chorke.org/soft/comn/ant/apache-ant-1.9.9.zip &&
unzip apache-ant-1.9.9.zip /opt/cli/
wget http://cdn.chorke.org/soft/comn/maven/apache-maven-3.3.9.zip &&
unzip apache-maven-3.3.9.zip -d cli/