Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit b8831f7

Browse files
committed
Clarify reason for blank file in python containers
#67
1 parent 7aabfd7 commit b8831f7

File tree

16 files changed

+67
-18
lines changed

16 files changed

+67
-18
lines changed

containers/python-2/.devcontainer/Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ ENV DEBIAN_FRONTEND=noninteractive
1010
# Set the default shell to bash rather than sh
1111
ENV SHELL /bin/bash
1212

13+
# Copy requirements.txt (if found) to a temp locaition so we can install it. Also
14+
# copy "noop.txt" so the COPY instruction does not fail if no requirements.txt exists.
15+
COPY requirements.txt* .devcontainer/noop.txt /tmp/pip-tmp/
16+
1317
# Configure apt and install packages
1418
RUN apt-get update \
1519
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
@@ -20,10 +24,14 @@ RUN apt-get update \
2024
# Install pylint
2125
&& pip install pylint \
2226
#
27+
# Update Python environment based on requirements.txt (if presenet)
28+
&& if [ -f "/tmp/pip-tmp/requirements.txt" ]; then pip install -r /tmp/pip-tmp/requirements.txt; fi \
29+
&& rm -rf /tmp/pip-tmp \
30+
#
2331
# Clean up
2432
&& apt-get autoremove -y \
2533
&& apt-get clean -y \
2634
&& rm -rf /var/lib/apt/lists/*
2735

2836
# Switch back to dialog for any ad-hoc use of apt-get
29-
ENV DEBIAN_FRONTEND=dialog
37+
ENV DEBIAN_FRONTEND=dialog

containers/python-2/.devcontainer/devcontainer.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
// Uncomment the next line if you want to publish any ports.
77
// "appPort": [],
88

9+
// Uncomment the next line to run commands after the container is created.
10+
// "postCreateCommand": "java -version",
11+
912
"extensions": [
1013
"ms-python.python"
1114
],
1215
"settings": {
1316
"python.pythonPath": "/usr/local/bin/python",
1417
"python.linting.pylintEnabled": true,
1518
"python.linting.enabled": true
16-
},
17-
// Install contents of requirements.txt if present
18-
"postCreateCommand": "if [ -f requirements.txt ]; then pip install -r requirements.txt; fi"
19+
}
1920
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This file copied into the container along with requirements.txt* from the parent
2+
folder. This file is included to prevents the Dockerfile COPY instruction from
3+
failing if no requirements.txt is found.

containers/python-3-anaconda/.devcontainer/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ ENV DEBIAN_FRONTEND=noninteractive
1010
# Set the default shell to bash rather than sh
1111
ENV SHELL /bin/bash
1212

13+
# Copy environment.yml (if found) to a temp locaition so we update the environment. Also
14+
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
15+
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
16+
1317
# Configure apt and install packages
1418
RUN apt-get update \
1519
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
@@ -20,6 +24,10 @@ RUN apt-get update \
2024
# Install pylint
2125
&& pip install pylint \
2226
#
27+
# Update Python environment based on environment.yml (if presenet)
28+
&& if [ -f "/tmp/conda-tmp/environment.yml" ]; then conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
29+
&& rm -rf /tmp/conda-tmp \
30+
#
2331
# Clean up
2432
&& apt-get autoremove -y \
2533
&& apt-get clean -y \

containers/python-3-anaconda/.devcontainer/devcontainer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@
1616
"python.pythonPath": "/opt/conda/bin/python",
1717
"python.linting.pylintEnabled": true,
1818
"python.linting.enabled": true
19-
},
20-
// Install contents of environment.yml if present
21-
"postCreateCommand": "if [ -f environment.yml ]; then conda env update base -f environment.yml; fi"
19+
}
2220
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This file copied into the container along with environment.yml* from the parent
2+
folder. This file is included to prevents the Dockerfile COPY instruction from
3+
failing if no environment.yml is found.

containers/python-3-miniconda/.devcontainer/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ ENV DEBIAN_FRONTEND=noninteractive
1010
# Set the default shell to bash rather than sh
1111
ENV SHELL /bin/bash
1212

13+
# Copy environment.yml (if found) to a temp locaition so we update the environment. Also
14+
# copy "noop.txt" so the COPY instruction does not fail if no environment.yml exists.
15+
COPY environment.yml* .devcontainer/noop.txt /tmp/conda-tmp/
16+
1317
# Configure apt and install packages
1418
RUN apt-get update \
1519
&& apt-get -y install --no-install-recommends apt-utils 2>&1 \
@@ -20,6 +24,10 @@ RUN apt-get update \
2024
# Install pylint
2125
&& pip install pylint \
2226
#
27+
# Update Python environment based on environment.yml (if presenet)
28+
&& if [ -f "/tmp/conda-tmp/environment.yml" ]; then conda env update -n base -f /tmp/conda-tmp/environment.yml; fi \
29+
&& rm -rf /tmp/conda-tmp \
30+
#
2331
# Clean up
2432
&& apt-get autoremove -y \
2533
&& apt-get clean -y \

containers/python-3-miniconda/.devcontainer/devcontainer.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@
1616
"python.pythonPath": "/opt/conda/bin/python",
1717
"python.linting.pylintEnabled": true,
1818
"python.linting.enabled": true
19-
},
20-
// Install contents of environment.yml if present
21-
"postCreateCommand": "if [ -f environment.yml ]; then conda env update base -f environment.yml; fi"
19+
}
2220
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This file copied into the container along with environment.yml* from the parent
2+
folder. This file is included to prevents the Dockerfile COPY instruction from
3+
failing if no environment.yml is found.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
dependencies:
22
- jupyter
33
- numpy
4-
- matplotlib
4+
- matplotlib
5+

0 commit comments

Comments
 (0)