Skip to content

Commit a9f4a63

Browse files
committed
use python variable to install right version of python in all docker images
1 parent 8eaa05e commit a9f4a63

File tree

10 files changed

+32
-21
lines changed

10 files changed

+32
-21
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ENV PYTHON_VERSION=${PYTHON_VERSION:-"2.7"} \
1616
# install python
1717
RUN apt-get -q -q update \
1818
&& apt-get install -y --no-install-recommends python${PYTHON_VERSION} curl \
19-
&& ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python \
19+
&& if [ ! -e /usr/bin/python ]; then ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python; fi \
2020
&& curl -k https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py \
2121
&& python /tmp/get-pip.py \
2222
&& pip install --upgrade setuptools \
@@ -31,7 +31,7 @@ RUN pip install --upgrade /tmp/pyclowder \
3131

3232
# folder for pyclowder code
3333
WORKDIR /home/clowder
34-
COPY notifications.json /home/clowder
34+
COPY notifications.json /home/clowder/
3535

3636
# command to run when starting container
3737
CMD python "./${MAIN_SCRIPT}"

Dockerfile.onbuild

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM clowder/pyclowder
1+
ARG PYCLOWDER_PYTHON=""
2+
FROM clowder/pyclowder${PYCLOWDER_PYTHON}:latest
23

34
# install any packages
45
ONBUILD COPY packages.* Dockerfile /home/clowder/

docker.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@ export DEBUG=${DEBUG:-""}
88

99
# build docker container based on python 2
1010
${DEBUG} docker build --build-arg PYTHON_VERSION=2.7 --tag clowder/pyclowder:latest .
11-
${DEBUG} docker build --build-arg PYTHON_VERSION=2.7 --tag clowder/pyclowder:onbuild --file Dockerfile.onbuild .
12-
${DEBUG} docker build --build-arg PYTHON_VERSION=2.7 --tag clowder/extractors-binary-preview:onbuild sample-extractors/binary-preview
13-
${DEBUG} docker build --build-arg PYTHON_VERSION=2.7 --tag clowder/extractors-simple-extractor:onbuild sample-extractors/simple-extractor
14-
${DEBUG} docker build --build-arg PYTHON_VERSION=2.7 --tag clowder/extractors-simple-r-extractor:onbuild sample-extractors/simple-r-extractor
11+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="" --tag clowder/pyclowder:onbuild --file Dockerfile.onbuild .
12+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="" --tag clowder/extractors-binary-preview:onbuild sample-extractors/binary-preview
13+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="" --tag clowder/extractors-simple-extractor:onbuild sample-extractors/simple-extractor
14+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="" --tag clowder/extractors-simple-r-extractor:onbuild sample-extractors/simple-r-extractor
1515

1616
# build docker container based on python 3
1717
${DEBUG} docker build --build-arg PYTHON_VERSION=3.5 --tag clowder/pyclowder-python3:latest .
18-
${DEBUG} docker build --build-arg PYTHON_VERSION=3.5 --tag clowder/pyclowder-python3:onbuild --file Dockerfile.onbuild .
19-
${DEBUG} docker build --build-arg PYTHON_VERSION=3.5 --tag clowder/extractors-binary-preview-python3:onbuild sample-extractors/binary-preview
20-
${DEBUG} docker build --build-arg PYTHON_VERSION=3.5 --tag clowder/extractors-simple-extractor-python3:onbuild sample-extractors/simple-extractor
21-
${DEBUG} docker build --build-arg PYTHON_VERSION=3.5 --tag clowder/extractors-simple-r-extractor-python3:onbuild sample-extractors/simple-r-extractor
18+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="-python3" --tag clowder/pyclowder-python3:onbuild --file Dockerfile.onbuild .
19+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="-python3" --tag clowder/extractors-binary-preview-python3:onbuild sample-extractors/binary-preview
20+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="-python3" --tag clowder/extractors-simple-extractor-python3:onbuild sample-extractors/simple-extractor
21+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="-python3" --tag clowder/extractors-simple-r-extractor-python3:onbuild sample-extractors/simple-r-extractor
22+
2223

2324
# build sample extractors
24-
${DEBUG} docker build --tag clowder/extractors-wordcount:latest sample-extractors/wordcount
25-
${DEBUG} docker build --tag clowder/extractors-wordcount-simple-extractor:latest sample-extractors/wordcount-simple-extractor
26-
${DEBUG} docker build --tag clowder/extractors-wordcount-simple-r-extractor:latest sample-extractors/wordcount-simple-r-extractor
25+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="-python3" --tag clowder/extractors-wordcount:latest sample-extractors/wordcount
26+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="-python3" --tag clowder/extractors-wordcount-simple-extractor:latest sample-extractors/wordcount-simple-extractor
27+
${DEBUG} docker build --build-arg PYCLOWDER_PYTHON="-python3" --tag clowder/extractors-wordcount-simple-r-extractor:latest sample-extractors/wordcount-simple-r-extractor
2728

2829
# build contrib
2930
${DEBUG} docker build --tag clowder/extractors-monitor:latest contrib/monitor

sample-extractors/binary-preview/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM clowder/pyclowder:onbuild
1+
ARG PYCLOWDER_PYTHON=""
2+
FROM clowder/pyclowder${PYCLOWDER_PYTHON}:onbuild
23

34
ENV MAIN_SCRIPT="binary_extractor.py" \
45
RABBITMQ_QUEUE="" \

sample-extractors/echo/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM clowder/pyclowder:2
1+
ARG PYCLOWDER_PYTHON=""
2+
FROM clowder/pyclowder${PYCLOWDER_PYTHON}:latest
23

34
# folder for code
45
WORKDIR /src

sample-extractors/simple-extractor/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
FROM clowder/pyclowder:onbuild
1+
ARG PYCLOWDER_PYTHON=""
2+
FROM clowder/pyclowder${PYCLOWDER_PYTHON}:latest
23

34
ENV EXTRACTION_FUNC=""
45
ENV EXTRACTION_MODULE=""
56

7+
COPY simple_extractor.py .
8+
69
# install any packages
710
ONBUILD COPY packages.* Dockerfile /home/clowder/
811
ONBUILD RUN if [ -e packages.apt ]; then \

sample-extractors/simple-r-extractor/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM clowder/pyclowder:latest
1+
ARG PYCLOWDER_PYTHON=""
2+
FROM clowder/pyclowder${PYCLOWDER_PYTHON}:latest
23

34
ENV R_SCRIPT="" \
45
R_FUNCTION=""
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM clowder/extractors-simple-extractor:onbuild
1+
ARG PYCLOWDER_PYTHON=""
2+
FROM clowder/extractors-simple-extractor${PYCLOWDER_PYTHON}:onbuild
23

34
ENV EXTRACTION_FUNC="wordcount"
45
ENV EXTRACTION_MODULE="wordcount"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM clowder/extractors-simple-r-extractor:onbuild
1+
ARG PYCLOWDER_PYTHON=""
2+
FROM clowder/extractors-simple-r-extractor${PYCLOWDER_PYTHON}:onbuild
23

34
ENV R_SCRIPT="wordcount.R" \
45
R_FUNCTION="process_file"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
FROM clowder/pyclowder:onbuild
1+
ARG PYCLOWDER_PYTHON=""
2+
FROM clowder/pyclowder${PYCLOWDER_PYTHON}:onbuild
23

34
ENV MAIN_SCRIPT="wordcount.py"

0 commit comments

Comments
 (0)