-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile_debian_jessie
55 lines (41 loc) · 2.1 KB
/
Dockerfile_debian_jessie
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# A Dockerfile to create a container running the TemPSS template and profile service
# available from https://www.github.com/london-escience/tempss.git
# Build on the base ubuntu 14.04 image
#FROM ubuntu:14.04
FROM debian:jessie
MAINTAINER Jeremy Cohen <[email protected]>
# Expose the ports that services run on
EXPOSE 8080
EXPOSE 8443
EXPOSE 22
# Update package lists and install JDK, Tomcat, Maven, git, and an SSH server
# Before the package update, switch to using the UK debian mirror since having
# issues with the redirector that is configured by default
RUN sed -i 's/httpredir\.debian\.org/ftp\.uk\.debian\.org/g' /etc/apt/sources.list
RUN apt-get update && apt-get install -y openjdk-7-jdk tomcat8 git-core maven2 supervisor openssh-server
# Create and configure the tempss user
RUN adduser --disabled-password --gecos "" tempss
RUN usermod -a -G tomcat8 tempss
# Set up SSH key
RUN mkdir -p /root/.ssh/
# Add your SSH key here if you want to be able to SSH to the container
#RUN echo "" >> /root/.ssh/authorized_keys
# Edit the Tomcat context configuration to ensure trailing slash redirection is
# enabled. Restart tomcat8
RUN sed -i 's/<Context>/<Context mapperContextRootRedirectEnabled=\"true\" mapperDirectoryRedirectEnabled=\"true\">/' /var/lib/tomcat8/conf/context.xml
# Switch to tempss user and build and deploy the tempss-service
USER tempss
WORKDIR /home/tempss
RUN ["pwd"]
# Can clone the latest code directly from git but for now, adding local copy.
# RUN git clone https://www.github.com/london-escience/tempss.git
# OR create directory manually and copy in local code as done below
RUN ["mkdir", "tempss"]
ADD . /home/tempss/tempss
WORKDIR /home/tempss/tempss
RUN ["pwd"]
RUN ["mvn", "package"]
RUN ["cp", "-p", "target/tempss.war", "/var/lib/tomcat8/webapps/"]
USER root
RUN echo '; supervisor configuration file for tempss\n\n[supervisord]\nnodaemon=true\n\n[program:sshd]\ncommand=/etc/init.d/ssh start\n\n[program:tomcat8]\ncommand=/etc/init.d/tomcat8 start\nautorestart=false\n' >> /etc/supervisor/conf.d/tempss.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]