22# podman build --build-arg groupid=<groupid> --build-arg userid=<userid> --build-arg groupname=<groupname> --no-cache -f path/to/Dockerfiles/murfey-server -t murfey-server:<version> path/to/python-murfey
33
44# Set up the Python base image to build with
5- FROM docker.io/library/python:3.12.8-slim-bullseye as build
5+ FROM docker.io/library/python:3.12.8-slim-bullseye AS base
66
77# Define external build arguments
88ARG groupid
@@ -11,6 +11,7 @@ ARG userid
1111
1212# Add system dependencies for the developer/build environment
1313# Add the group and user ID to be used by Murfey
14+ # Create virtual Python environment in which to install Murfey
1415RUN apt-get update && \
1516 apt-get upgrade -y && \
1617 apt-get install -y --no-install-recommends \
@@ -21,33 +22,22 @@ RUN apt-get update && \
2122 libpq-dev && \
2223 busybox --install &&\
2324 rm -rf /var/lib/apt/lists/* && \
24- groupadd -r -g "${groupid}" "${groupname}" && useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}"
25-
26- # Copy essential Murfey source files across from repo
27- COPY --chown="${userid}":"${groupid}" src/murfey/ /repos/python-murfey/src/murfey/
28- COPY --chown="${userid}":"${groupid}" \
29- pyproject.toml \
30- setup.py \
31- api-spec.yaml \
32- AUTHORS.rst \
33- catalog-info.yaml \
34- LICENSE \
35- MANIFEST.in \
36- README.md \
37- /repos/python-murfey/
38-
39- # Set the repo as the current working directory
40- WORKDIR /repos/python-murfey
25+ groupadd -r -g "${groupid}" "${groupname}" && \
26+ useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \
27+ python -m venv /venv && \
28+ chmod -R a+x /venv
29+ ENV PATH=/venv/bin:$PATH
4130
42- # Set up a virtual environment and install Murfey
43- RUN python -m venv /venv && \
44- chmod -R a+x /venv && \
45- /venv/bin/ python -m pip install --upgrade \
31+ # Build Murfey in a different image
32+ FROM base AS build
33+ COPY --chown="${userid}":"${groupid}" ./ /python-murfey/
34+ RUN python -m pip install --upgrade \
4635 pip \
4736 build \
4837 importlib-metadata \
4938 psycopg2-binary && \
50- /venv/bin/ python -m pip install . [server]
39+ python -m pip install /python-murfey [server]
5140
52- # Prepend the virtual environment to PATH
53- ENV PATH=/venv/bin:$PATH
41+ # Copy installed files across to final image
42+ FROM base
43+ COPY --from=build --chown="${userid}":"${groupid}" /venv/ /venv/
0 commit comments