Skip to content

Commit bfc624a

Browse files
committed
Made similar changes to 'murfey-instrument-server' Dockerfile
1 parent 5f0b774 commit bfc624a

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

Dockerfiles/murfey-instrument-server

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# podman build --build-arg groupid=<groupid> --build-arg userid=<userid> --build-arg groupname=<groupname> --no-cache -f path/to/Dockerfiles/murfey-instrument-server -t murfey-instrument-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
88
ARG groupid
@@ -11,6 +11,8 @@ 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
15+
# Change properties of said Python environment
1416
RUN apt-get update && \
1517
apt-get upgrade -y && \
1618
apt-get install -y --no-install-recommends \
@@ -19,34 +21,25 @@ RUN apt-get update && \
1921
git \
2022
net-tools \
2123
libpq-dev && \
22-
busybox --install &&\
24+
busybox --install && \
2325
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
26+
groupadd -r -g "${groupid}" "${groupname}" && \
27+
useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \
28+
python -m venv /venv && \
29+
chown -R "${userid}":"${groupid}" /venv && \
30+
chmod -R a+x /venv
31+
ENV PATH=/venv/bin:$PATH
4132

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 \
33+
# Build Murfey in a different image
34+
FROM base AS build
35+
COPY --chown="${userid}":"${groupid}" ./ /python-murfey/
36+
RUN python -m pip install --upgrade \
4637
pip \
4738
build \
4839
importlib-metadata &&\
49-
/venv/bin/python -m pip install .[client,instrument-server]
40+
python -m pip install /python-murfey[client,instrument-server] && \
41+
chmod -R a+x /venv
5042

51-
# Prepend the virtual environment to PATH
52-
ENV PATH=/venv/bin:$PATH
43+
# Copy installed files across to final image
44+
FROM base
45+
COPY --from=build --chown="${userid}":"${groupid}" /venv/ /venv/

0 commit comments

Comments
 (0)