瀏覽代碼

updates Dockerfile

Jaco Verster 1 年之前
父節點
當前提交
3438dc53d8
共有 1 個文件被更改,包括 21 次插入23 次删除
  1. 21 23
      .devcontainer/Dockerfile

+ 21 - 23
.devcontainer/Dockerfile

@@ -1,42 +1,40 @@
-FROM python:3.8-slim as builder
-
-RUN apt update && apt install -y \
-    gcc \
-    && rm -rf /var/lib/apt/lists/*
-
-RUN python3 -m pip install --upgrade pip
-
-# netifaces needs to be compiled on some platforms (macos ARM for example)
-RUN python3 -m pip install netifaces
-
-FROM python:3.8-slim as devcontainer
+FROM python:3.8-slim as base
 
 ENV POETRY_VERSION=1.6.1 \
     POETRY_NO_INTERACTION=1 \
     POETRY_VIRTUALENVS_IN_PROJECT=false \
     POETRY_VIRTUALENVS_CREATE=false \
-    POETRY_CACHE_DIR=/tmp/poetry_cache \
     DEBIAN_FRONTEND=noninteractive \
+    SHELL=/bin/bash \
     DISPLAY=:99
 
-# Chrome and chromedriver versions must match
-# See https://chromiumdash.appspot.com/home
-ARG CHROMIUM_VERSION=117.0.5938.62
+FROM base as builder
+
+RUN apt-get update && apt-get install --no-install-recommends -y \
+    gcc \
+    && rm -rf /var/lib/apt/lists/*
+
+# Netifaces needs to be compiled on some platforms (macos ARM for example)
+RUN pip install -U pip && pip install netifaces
+
+FROM base as devcontainer
 
-# Create remote user and install google chromium and chromium-driver
+COPY --from=builder /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
+
+# Install packages
+RUN apt-get update && apt-get install --no-install-recommends -y \
+    sudo git chromium chromium-driver \
+    && rm -rf /var/lib/apt/lists/*
+
+# Create remote user
 ARG USERNAME=vscode
 ARG USER_UID=1000
 ARG USER_GID=$USER_UID
 
 RUN groupadd --gid $USER_GID $USERNAME \
     && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
-    && apt-get update && apt-get install --no-install-recommends -y \
-    sudo git chromium=${CHROMIUM_VERSION}* chromium-driver=${CHROMIUM_VERSION}* \
     && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
-    && chmod 0440 /etc/sudoers.d/$USERNAME \
-    && rm -rf /var/lib/apt/lists/*
-
-COPY --from=builder /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
+    && chmod 0440 /etc/sudoers.d/$USERNAME
 
 # Install nicegui
 RUN pip install -U pip && pip install poetry==$POETRY_VERSION