Commit a19639b9 authored by Alexandre Beelen's avatar Alexandre Beelen

Drop two stage build, Add PIIC

parent e86aabb9
FROM debian:stretch
ARG release
ENV release=${release}
FROM debian:stretch as gildas_worker
RUN apt-get -y update && apt-get install -y \
libx11-6 \
libpng16-16 \
......@@ -8,12 +6,63 @@ RUN apt-get -y update && apt-get install -y \
libcfitsio5 \
libforms2 \
python \
libpython2.7 \
python-numpy \
python-dev \
libgtk2.0
RUN echo 'export GAG_ROOT_DIR=/gildas-exe-$release' >> /etc/bash.bashrc && \
FROM gildas_worker as gildas_builder
RUN apt-get -y update && apt-get install -y \
libx11-dev \
libpng-dev \
libfftw3-dev \
libcfitsio-dev \
libforms-dev \
python-dev \
libgtk2.0-dev \
gfortran \
curl
FROM gildas_builder as builder
ARG release
ENV release=${release}
ARG ARCHIVE
# if --build-arg ARCHIVE=1 set the url to the archive page
ENV GILDAS_URL=${ARCHIVE:+http://www.iram.fr/~gildas/dist/archive/gildas}
# else keep the main directory
ENV GILDAS_URL=${GILDAS_URL:-http://www.iram.fr/~gildas/dist}
CMD sh -c
RUN curl $GILDAS_URL/gildas-src-$release.tar.xz | tar xJ && \
bash -c "cd gildas-src-$release && GAG_SEARCH_PATH=/usr/lib/x86_64-linux-gnu source admin/gildas-env.sh -o openmp && \
make && make -j 4 install" && \
echo 'export GAG_ROOT_DIR=/gildas-exe-$release' >> /etc/bash.bashrc && \
echo 'export GAG_EXEC_SYSTEM=x86_64-debian9-gfortran-openmp' >> /etc/bash.bashrc && \
echo '. $GAG_ROOT_DIR/etc/bash_profile' >> /etc/bash.bashrc
COPY gildas-exe-$release /gildas-exe-$release
# COPY gildas-exe-$release.tar.gz /
# RUN tar xvzf gildas-exe-$release.tar.gz
echo '. $GAG_ROOT_DIR/etc/bash_profile' >> /etc/bash.bashrc && \
rm -Rf gildas-src-$release && \
cd gildas-exe-$release && curl $GILDAS_URL/gildas-doc-$release.tar.xz | tar xJ
FROM gildas_worker
ARG release
ENV release=${release}
COPY --from=builder /gildas-exe-$release /gildas-exe-$release
ARG PIIC_ARCHIVE
# if --build-arg ARCHIVE=1 set the url to the archive page
ENV GILDAS_URL=${PIIC_ARCHIVE:+http://www.iram.fr/~gildas/dist/archive/gildas}
# else keep the main directory
ENV GILDAS_URL=${GILDAS_URL:-http://www.iram.fr/~gildas/dist}
RUN curl $GILDAS_URL/piic-exe-$release.tar.xz | tar xJ
RUN echo '# \n\
# Two separate gildas environement (PIIC.README)...\n\
gagpiic () {\n\
export GAG_ROOT_DIR=/piic-exe-$release\n\
export GAG_EXEC_SYSTEM=x86_64-generic\n\
. $GAG_ROOT_DIR/etc/bash_profile\n\
}\n\
gaggildas () {\n\
export GAG_ROOT_DIR=/gildas-exe-$release\n\
export GAG_EXEC_SYSTEM=x86_64-debian9-gfortran-openmp\n\
. $GAG_ROOT_DIR/etc/bash_profile\n\
}\n'\
>> /etc/bash.bashrc
ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/bash.bashrc", "-i", "-c"]
FROM debian:stretch
ARG release
ENV release=${release}
RUN apt-get -y update && apt-get install -y \
libx11-dev \
libpng-dev \
libfftw3-dev \
libcfitsio-dev \
libforms-dev \
python-dev \
python-numpy \
Libgtk2.0-dev \
gfortran \
curl
RUN curl http://www.iram.fr/~gildas/dist/gildas-src-$release.tar.gz | tar xz && \
bash -c "cd gildas-src-$release && \
GAG_SEARCH_PATH=/usr/lib/x86_64-linux-gnu source admin/gildas-env.sh -o openmp && \
make && make -j 4 install" && \
echo 'export GAG_ROOT_DIR=/gildas-exe-$release' >> /etc/bash.bashrc && \
echo 'export GAG_EXEC_SYSTEM=x86_64-debian9-gfortran-openmp' >> /etc/bash.bashrc && \
echo '. $GAG_ROOT_DIR/etc/bash_profile' >> /etc/bash.bashrc && \
rm -Rf gildas-src-$release && \
cd gildas-exe-$release && \
curl http://www.iram.fr/~gildas/dist/gildas-doc-$release.tar.gz | tar xz
FROM debian:stretch as gildas_worker
RUN apt-get -y update && apt-get install -y \
libx11-6 \
libpng16-16 \
libfftw3-3 \
libcfitsio5 \
libforms2 \
python \
python-numpy \
libgtk2.0
FROM gildas_worker as gildas_builder
RUN apt-get -y update && apt-get install -y \
libx11-dev \
libpng-dev \
libfftw3-dev \
libcfitsio-dev \
libforms-dev \
python-dev \
libgtk2.0-dev \
gfortran \
curl
FROM gildas_builder as builder
ARG release
ENV release=${release}
RUN curl http://www.iram.fr/~gildas/dist/gildas-src-$release.tar.xz | tar xJ && \
bash -c "cd gildas-src-$release && GAG_SEARCH_PATH=/usr/lib/x86_64-linux-gnu source admin/gildas-env.sh -o openmp && \
make && make -j 4 install" && \
echo 'export GAG_ROOT_DIR=/gildas-exe-$release' >> /etc/bash.bashrc && \
echo 'export GAG_EXEC_SYSTEM=x86_64-debian9-gfortran-openmp' >> /etc/bash.bashrc && \
echo '. $GAG_ROOT_DIR/etc/bash_profile' >> /etc/bash.bashrc && \
rm -Rf gildas-src-$release && \
cd gildas-exe-$release && curl http://www.iram.fr/~gildas/dist/gildas-doc-$release.tar.xz | tar xJ
FROM gildas_worker
ARG release
ENV release=${release}
RUN echo 'export GAG_ROOT_DIR=/gildas-exe-$release' >> /etc/bash.bashrc && \
echo 'export GAG_EXEC_SYSTEM=x86_64-debian9-gfortran-openmp' >> /etc/bash.bashrc && \
echo '. $GAG_ROOT_DIR/etc/bash_profile' >> /etc/bash.bashrc
COPY --from=builder /gildas-exe-$release /gildas-exe-$release
# Build
## Two stages build
## Two stage build
(Obsolete, see commit older than e86aabb9c4a207889685875f345f1a0b8b0cbdbf)
Build the developpement image :
## One stage build
With Docker 17.05 or higher :
```bash
export release=mar18c
docker build --tag abeelen/gildas:build --build-arg release=$release -f Dockerfile.dev .
docker build --tag abeelen/gildas:$release --tag abeelen/gildas:latest --build-arg release=$release -f Dockerfile .
```
extract the compiled files
## PIIC
```
docker container create --name extract abeelen/gildas:build
docker container cp extract:/gildas-exe-$release gildas-exe-$release
docker container rm -f extract
```
Starting with oct19a, PIIC is included in the container, with 2 possible arguments, `ARCHIVE=1` will look for gildas in the archive , while `PIIC_ARCHIVE`, will look for piic in the archive
<!---
extract the compiled files
```
docker run -it -u $(id -u) \
-v "/home/$USER:/home/$USER" \
abeelen/gildas:build tar cvzf $PWD/gildas-exe-$release.tar.gz /gildas-exe-$release
```
--->
Build the execution image :
```bash
docker build --tag abeelen/gildas:$release --tag abeelen/gildas:latest --build-arg release=$release -f Dockerfile .
export release=oct19a
docker build --tag abeelen/gildas:${release} --tag abeelen/gildas:latest --build-arg ARCHIVE=1 --build-arg release=$release -f Dockerfile .
```
will look for gildas oct19a in the archive, while PIIC will be downloaded from the regular directory
## One stage build
# Usage
With Docker 17.05 or higher :
To launch the gildas container, type :
```bash
export release=mar18c
docker build --tag abeelen/gildas:$release --tag abeelen/gildas:latest --build-arg release=$release -f Dockerfile.multistage .
docker run -it \
--hostname "gildas" --user $(id -u):$(id -g) \
--workdir="/home/$USER" --env HOME=${HOME} --env USER=${USER} --env DISPLAY=${DISPLAY} \
--volume "/etc/passwd:/etc/passwd:ro" \
--volume "/home/$USER:/home/$USER" \
--volume "/Users/$USER:/Users/$USER" \
--volume "/tmp/.X11-unix:/tmp/.X11-unix" \
abeelen/gildas:latest /bin/bash --rcfile /etc/bash.bashrc
```
# Usage
where
```bash
-volume "/home/$USER:/home/$USER"
```
will mount the user home for Unix Users
```bash
-volume "/Users/$USER:/Users/$USER"
```
will do the same for MacOS users
Starting from the oct19a, one has to define which gildas environement to use either `gaggildas` or `gagpiic` before launching gildas command. It is easier to create usefull aliases in `~/.bashrc`
To launch gildas, simply launch :
```bash
alias gildas_docker='docker run -it \
--hostname "gildas" --user $(id -u):$(id -g) \
--workdir="/home/$USER" --env HOME=${HOME} --env USER=${USER} --env DISPLAY=${DISPLAY} \
--volume "/etc/passwd:/etc/passwd:ro" \
--volume "/home/$USER:/home/$USER" \
--volume "/Users/$USER:/Users/$USER" \
--volume "/tmp/.X11-unix:/tmp/.X11-unix" \
abeelen/gildas:latest'
```bash
docker run -it --hostname "gildas" -u $(id -u) \
-e DISPLAY=${DISPLAY} -e HOME=${HOME} -e USER=${USER} \
-v "/etc/passwd:/etc/passwd:ro" \
-v "/home/$USER:/home/$USER" \
-v "/tmp/.X11-unix:/tmp/.X11-unix" \
abeelen/gildas:latest /bin/bash --rcfile /etc/bash.bashrc
alias clic='gildas_docker "gaggildas; clic"'
alias mapping='gildas_docker "gaggildas; mapping"'
alias astro='gildas_docker "gaggildas; astro"'
alias piic='gildas_docker "gagpiic; piic"'
[...]
```
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment