Skip to content

Commit

Permalink
make docker images a bit smaller (#1034)
Browse files Browse the repository at this point in the history
* make docker images a bit smaller
* change terminal colors
  • Loading branch information
kratsg authored Sep 15, 2017
1 parent 530f161 commit 6de23f4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
38 changes: 21 additions & 17 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,37 @@ ENV TRAVIS_JOB_ID=${TRAVIS_JOB_ID}
WORKDIR $TMPDIR
WORKDIR /home/atlas

# Switch to ROOT user for now
USER root
### COPY COMMANDS HERE ###

# Copy the project's sources into the image
COPY . /workarea/src/xAODAnaHelpers
# this is needed to get rpmbuild temp dir in different place
COPY ci/.rpmmacros /root/.rpmmacros
# Build the project inside a build/ directory
RUN /workarea/src/xAODAnaHelpers/ci/compile.sh
# Use our MOTD (Message-of-the-Day)
COPY ci/motd /etc/motd
# Copy the environemnt setup script for xAH
COPY ci/xAODAnaHelpers_setup.sh /home/atlas/xAODAnaHelpers_setup.sh

# create an RPM
RUN cd /workarea/build && cpack
# Install the created RPM
RUN rpm -i /workarea/build/*_*.rpm
# Clean up
RUN rm -rf /workarea
### RUN COMMANDS HERE (AS ROOT) ###
# Switch to ROOT user for now
USER root
# 1. Build the project inside a build/ directory
# 2. Create an RPM
# 3. Install the RPM
# 4. Clean up
# 5. Call the MOTD
# 6. Call the environment setup script in .bashrc
RUN /workarea/src/xAODAnaHelpers/ci/compile.sh \
&& cd /workarea/build && cpack \
&& rpm -i /workarea/build/*_*.rpm \
&& rm -rf /workarea \
&& echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' >> /home/atlas/.bashrc \
&& echo 'source $HOME/xAODAnaHelpers_setup.sh' >> /home/atlas/.bashrc

# set TMPDIR back
ENV TMPDIR=/tmp

# Switch back to the ATLAS account
USER atlas
# Use our MOTD (Message-of-the-Day)
COPY ci/motd /etc/motd
RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/motd' >> $HOME/.bashrc
# Set up the environment setup script and add to bashrc
COPY ci/xAODAnaHelpers_setup.sh /home/atlas/xAODAnaHelpers_setup.sh
RUN echo 'source $HOME/xAODAnaHelpers_setup.sh' >> /home/atlas/.bashrc
# Start the image with BASH by default
CMD /bin/bash

Expand Down
2 changes: 1 addition & 1 deletion ci/xAODAnaHelpers_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ source /usr/xAODAnaHelpers/*/InstallArea/*/setup.sh
echo "Configured xAODAnaHelpers from: ${xAODAnaHelpers_DIR}"

# Set up the prompt:
export PS1="\[\e[1;31;40m\]xAODAnaHelpers-${xAODAnaHelpers_VERSION::6}\[\e[0m\]:\[\e[36;40m\]\w\[\e[1;33;40m\]$ \[\e[0m\]"
export PS1="\[\033[0;35m\][\u]\[\e[0;31m\][xAH-${xAODAnaHelpers_VERSION::6}]\[\e[0;35m\]:\[\e[0;36m\]\w\[\e[1;33m\]$ \[\e[0m\]"

0 comments on commit 6de23f4

Please sign in to comment.