Skip to content

Commit

Permalink
Dockerfile: reduce trips to github.com; take advantage of WORKDIR
Browse files Browse the repository at this point in the history
No functionality changes expected.
  • Loading branch information
drewp authored Aug 7, 2024
1 parent 1284f1e commit 946278b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ RUN apt update
RUN apt install --yes graphviz ${EXTRA_DEBIAN_PACKAGES}
# Store a list of all installed packages. Aeromancy will include this as
# metadata for each task.
RUN dpkg-query -f '${binary:Package}=${Version}\n' -W > /base/packages_list.txt
RUN dpkg-query -f '${binary:Package}=${Version}\n' -W > ./packages_list.txt

# Set up Python environment with pdm.
RUN pip3 install pdm

# pdm needs to see README.md and src/ (can be empty) to validate the project.
COPY --from=project pyproject.toml pdm.lock README.md /base/
RUN mkdir /base/src

# To access private repos on GitHub, we need to add it as a known host.
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts

# pdm needs to see README.md and src/ (can be empty) to validate the project.
COPY --from=project pyproject.toml pdm.lock README.md ./
RUN mkdir ./src

# --mount=type=ssh allows us to use forwarded SSH authentication.
# --no-self since we haven't copied our project-specific code here yet (we do
# that last since it's the most variable step and should help keep image build
Expand All @@ -35,4 +35,4 @@ RUN --mount=type=ssh pdm install --prod --no-self
# Include Python code.
# Note that `project` must be mapped as a build context:
# https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context
COPY --from=project ./src/ /base/src/
COPY --from=project ./src/ ./src/

0 comments on commit 946278b

Please sign in to comment.