Last active
August 29, 2015 14:16
-
-
Save azam/98805074a9a3b4bd1e28 to your computer and use it in GitHub Desktop.
Dockerfile for Debian 7 (Wheezy) , Oracle JDK 7 , and default user creation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (c) Azamshul Azizy, 2014 | |
# | |
# Original files: | |
# https://github.com/dockerfile/java/tree/master/oracle-java7 | |
# https://github.com/clifton/docker-debian-base/master/Dockerfile | |
# Pull base image. | |
FROM debian:7 | |
MAINTAINER Azamshul Azizy <[email protected]> | |
# Add apt sources | |
RUN echo "deb http://ftp.us.debian.org/debian/ wheezy main contrib non-free" > /etc/apt/sources.list | |
RUN echo "deb-src http://ftp.us.debian.org/debian/ wheezy main contrib non-free" >> /etc/apt/sources.list | |
RUN echo "deb http://security.debian.org/ wheezy/updates main contrib non-free" >> /etc/apt/sources.list | |
RUN echo "deb-src http://security.debian.org/ wheezy/updates main contrib non-free" >> /etc/apt/sources.list | |
RUN echo "deb http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free" >> /etc/apt/sources.list | |
RUN echo "deb-src http://ftp.us.debian.org/debian/ wheezy-updates main contrib non-free" >> /etc/apt/sources.list | |
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" >> /etc/apt/sources.list | |
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" >> /etc/apt/sources.list | |
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 | |
ENV DEBIAN_FRONTEND noninteractive | |
# Update apt packages | |
RUN apt-get update | |
RUN apt-get -y upgrade | |
RUN apt-get -y dist-upgrade | |
RUN apt-get -y install curl sudo | |
# Install Java. | |
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections | |
RUN apt-get install -y oracle-java7-installer | |
# Clean up | |
RUN rm -rf /var/lib/apt/lists/* | |
RUN rm -rf /var/cache/oracle-jdk7-installer | |
RUN apt-get clean | |
# Set up users | |
RUN \ | |
groupadd -g 433 -r appuser && \ | |
mkdir /home/appuser && \ | |
useradd -u 431 -r -g appuser -d /home/appuser -s /sbin/nologin -c "appuser" appuser && \ | |
chown -R appuser:appuser /home/appuser | |
# Change user | |
USER appuser | |
# Define working directory | |
WORKDIR /home/appuser | |
# Define commonly used JAVA_HOME variable | |
ENV JAVA_HOME /usr/lib/jvm/java-7-oracle | |
# Expose port | |
EXPOSE 80 | |
# Define default command. | |
CMD ["java -version"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment