diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5cc8deb..0a60a47 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -13,14 +13,6 @@ "python.venvPath": "./venv" } } - } - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "pip3 install --user -r requirements.txt", - // Configure tool-specific properties. - // "customizations": {}, - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" + }, + "postCreateCommand": "cd .venv/lib/*/site-packages/seleniumbase/drivers && rm -f uc_driver && ln -s /usr/bin/chromedriver uc_driver" } diff --git a/Dockerfile b/Dockerfile index 70365a7..6918a72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM debian:bullseye-slim AS base +ENV HOME=/root ARG GITHUB_BUILD=false \ VERSION @@ -10,7 +11,7 @@ ENV GITHUB_BUILD=${GITHUB_BUILD}\ # prevents python creating .pyc files PYTHONDONTWRITEBYTECODE=1 \ DISPLAY=:0\ - PATH="~/.local/bin:$PATH" + PATH="${HOME}/.local/bin:$PATH" WORKDIR /app @@ -18,26 +19,26 @@ RUN apt-get update && \ apt-get install -y --no-install-recommends --no-install-suggests xauth xvfb scrot curl chromium chromium-driver ca-certificates ADD https://astral.sh/uv/install.sh install.sh -RUN sh install.sh -COPY pyproject.toml uv.lock ./ -RUN --mount=type=cache,target="~/.cache/uv" uv sync - -# SeleniumBase does not come with an arm64 chromedriver binary -RUN cd .venv/lib/*/site-packages/seleniumbase/drivers && ln -s /usr/bin/chromedriver uc_driver +RUN sh install.sh && uv --version FROM base AS devcontainer -RUN apt-get install -y git && apt upgrade -y +RUN apt install -y git && apt upgrade -y ENV UV_LINK_MODE=copy ENTRYPOINT [ "sleep", "infinity" ] FROM base AS app +COPY pyproject.toml uv.lock ./ +RUN --mount=type=cache,target=${HOME}/.cache/uv uv sync + +# SeleniumBase does not come with an arm64 chromedriver binary +RUN cd .venv/lib/*/site-packages/seleniumbase/drivers && rm -f uc_driver && ln -s /usr/bin/chromedriver uc_driver COPY . . FROM app AS test -RUN --mount=type=cache,target=~/.cache/uv uv sync --group test +RUN --mount=type=cache,target=${HOME}/.cache/uv uv sync --group test RUN ./test.sh FROM app