|
1 | | -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.202.5/containers/python-3/.devcontainer/base.Dockerfile |
| 1 | +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.236.0/containers/python-3/.devcontainer/base.Dockerfile |
2 | 2 |
|
3 | 3 | # [Choice] Python version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.10, 3.9, 3.8, 3.7, 3.6, 3-bullseye, 3.10-bullseye, 3.9-bullseye, 3.8-bullseye, 3.7-bullseye, 3.6-bullseye, 3-buster, 3.10-buster, 3.9-buster, 3.8-buster, 3.7-buster, 3.6-buster |
4 | | -ARG VARIANT="3.10-bullseye" |
5 | | -FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} |
| 4 | +ARG VARIANT=3-bullseye |
| 5 | +FROM python:${VARIANT} |
6 | 6 | LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>" |
7 | 7 |
|
8 | | -# [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 |
9 | | -ARG NODE_VERSION="none" |
10 | | -RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi |
11 | | -RUN npm install -g yarn |
| 8 | +ENV DEBIAN_FRONTEND=noninteractive |
12 | 9 |
|
| 10 | +# Copy library scripts to execute |
| 11 | +ADD https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.236.0/containers/python-3/.devcontainer/library-scripts/common-debian.sh /tmp/library-scripts/ |
| 12 | +ADD https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.236.0/containers/python-3/.devcontainer/library-scripts/python-debian.sh /tmp/library-scripts/ |
| 13 | +ADD https://raw.githubusercontent.com/microsoft/vscode-dev-containers/v0.236.0/containers/python-3/.devcontainer/library-scripts/meta.env /tmp/library-scripts/ |
| 14 | + |
| 15 | +# [Option] Install zsh |
| 16 | +ARG INSTALL_ZSH="true" |
| 17 | +# [Option] Upgrade OS packages to their latest versions |
| 18 | +ARG UPGRADE_PACKAGES="true" |
| 19 | +# Install needed packages and setup non-root user. Use a separate RUN statement to add your own dependencies. |
| 20 | +ARG USERNAME=vscode |
| 21 | +ARG USER_UID=1000 |
| 22 | +ARG USER_GID=$USER_UID |
| 23 | +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ |
| 24 | + # Remove imagemagick due to https://security-tracker.debian.org/tracker/CVE-2019-10131 |
| 25 | + && apt-get purge -y imagemagick imagemagick-6-common \ |
| 26 | + # Install common packages, non-root user |
| 27 | + && bash /tmp/library-scripts/common-debian.sh "${INSTALL_ZSH}" "${USERNAME}" "${USER_UID}" "${USER_GID}" "${UPGRADE_PACKAGES}" "true" "true" |
| 28 | + |
| 29 | +# Setup default python tools in a venv via pipx to avoid conflicts |
| 30 | +ENV PIPX_HOME=/usr/local/py-utils \ |
| 31 | + PIPX_BIN_DIR=/usr/local/py-utils/bin |
| 32 | +ENV PATH=${PATH}:${PIPX_BIN_DIR} |
| 33 | +RUN bash /tmp/library-scripts/python-debian.sh "none" "/usr/local" "${PIPX_HOME}" "${USERNAME}" |
| 34 | + |
| 35 | +# [Choice] Node.js version: lts, 18, 16, 14, 12, 10 |
| 36 | +ARG NODE_VERSION="16" |
| 37 | +RUN curl -fsSL "https://deb.nodesource.com/setup_${NODE_VERSION}.x" | bash - |
| 38 | +RUN apt-get install -y nodejs make gcc g++ && npm install -g yarn |
| 39 | + |
| 40 | +# Remove library scripts for final image |
| 41 | +RUN rm -rf /tmp/library-scripts |
| 42 | + |
| 43 | +# Expose port 8000 |
13 | 44 | EXPOSE 8000 |
14 | 45 |
|
15 | | -ENV DEBIAN_FRONTEND=noninteractive |
16 | | - |
17 | 46 | # Add Docker Source |
18 | 47 | RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg |
19 | 48 | RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ |
20 | 49 | $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null |
21 | 50 |
|
22 | | -RUN apt-get update --fix-missing |
23 | | - |
24 | | -# apt-get upgrade is normally not a good idea, but this is a dev container |
25 | | -RUN apt-get -qy upgrade |
26 | | - |
27 | 51 | # Install the packages we need |
28 | | -RUN apt-get install -qy \ |
| 52 | +RUN apt-get update --fix-missing && apt-get install -qy \ |
29 | 53 | apache2-utils \ |
30 | 54 | apt-file \ |
31 | 55 | apt-utils \ |
@@ -87,8 +111,11 @@ RUN sed -i 's/\r$//' /tmp/app-install-chromedriver.sh && \ |
87 | 111 | chmod +x /tmp/app-install-chromedriver.sh |
88 | 112 | RUN /tmp/app-install-chromedriver.sh |
89 | 113 |
|
| 114 | +# Fix /dev/shm permissions for chromedriver |
| 115 | +RUN chmod 1777 /dev/shm |
| 116 | + |
90 | 117 | # Get rid of installation files we don't need in the image, to reduce size |
91 | | -RUN apt-get clean && rm -rf /var/lib/apt/lists/* |
| 118 | +RUN apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* |
92 | 119 |
|
93 | 120 | # "fake" dbus address to prevent errors |
94 | 121 | # https://github.com/SeleniumHQ/docker-selenium/issues/87 |
@@ -132,6 +159,12 @@ RUN sed -i 's/\r$//' /docker-init.sh && \ |
132 | 159 | RUN mkdir -p /workspace |
133 | 160 | WORKDIR /workspace |
134 | 161 |
|
| 162 | +# Fix user UID / GID to match host |
| 163 | +RUN groupmod --gid $USER_GID $USERNAME \ |
| 164 | + && usermod --uid $USER_UID --gid $USER_GID $USERNAME \ |
| 165 | + && chown -R $USER_UID:$USER_GID /home/$USERNAME \ |
| 166 | + || exit 0 |
| 167 | + |
135 | 168 | USER vscode:vscode |
136 | 169 |
|
137 | 170 | # Install current datatracker python dependencies |
|
0 commit comments