Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize Dockerfile #1682

Merged
1 commit merged into from
Jul 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,28 @@
FROM ubuntu
RUN apt-get update && apt-get -y install curl sudo procps wget && \
echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
useradd -u 1000 -G users,sudo -d /home/user --shell /bin/bash -m user && \
echo "secret\nsecret" | passwd user && \
curl -sSL https://get.docker.com/ | sh && \
# Add user to docker group: 100 and 50 are this gIDs in boot2docker and Docker for Mac
usermod -aG docker,100,50 user && \
sudo apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
FROM alpine:3.4

USER user
ENV LANG=C.UTF-8 \
JAVA_HOME=/usr/lib/jvm/default-jvm/jre \
PATH=${PATH}:${JAVA_HOME}/bin \
CHE_HOME=/home/user/che

ENV JAVA_VERSION=8u65 \
JAVA_VERSION_PREFIX=1.8.0_65 \
CHE_LOCAL_CONF_DIR=/home/user/.che
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk upgrade --update && \
apk add --update docker openjdk8 sudo bash && \
addgroup -S user -g 1000 && \
adduser -S user -h /home/user -s /bin/bash -G root -u 1000 -D && \
adduser user docker && \
adduser user user && \
echo "%root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
rm -rf /tmp/* /var/cache/apk/*

RUN mkdir /home/user/.che && \
wget \
--no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
-qO- \
"http://download.oracle.com/otn-pub/java/jdk/$JAVA_VERSION-b17/jre-$JAVA_VERSION-linux-x64.tar.gz" | sudo tar -zx -C /opt/
EXPOSE 8000 8080

ENV JAVA_HOME /opt/jre$JAVA_VERSION_PREFIX
ENV PATH $JAVA_HOME/bin:$PATH
USER user

EXPOSE 8080
ADD /assembly/assembly-main/target/eclipse-che-*/eclipse-che-* /home/user/che/

ADD /assembly/assembly-main/target/eclipse-che-*/eclipse-che-* /home/user/che
ENV CHE_HOME /home/user/che

ENTRYPOINT [ "/home/user/che/bin/che.sh", "-c" ]

CMD [ "run" ]