Skip to content

Commit 35bfb2a

Browse files
committed
Applied same fix to 'murfey-instrument-server' and corrected section comments
1 parent 6c9b4de commit 35bfb2a

File tree

2 files changed

+32
-25
lines changed

2 files changed

+32
-25
lines changed
Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
# Build command template
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

4-
# Set up the Python base image to build with
4+
# Set up the base image to build with
55
FROM docker.io/library/python:3.12.8-slim-bullseye AS base
66

7-
# Define external build arguments
8-
ARG groupid
9-
ARG groupname
10-
ARG userid
7+
# Install Vim in base image
8+
RUN apt-get update && \
9+
apt-get upgrade -y && \
10+
apt-get install -y --no-install-recommends \
11+
vim \
12+
&& \
13+
apt-get autoremove && \
14+
rm -rf /var/lib/apt/lists/*
1115

12-
# Add system dependencies for the developer/build environment
13-
# 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
16+
17+
# Build Murfey in a separate image
18+
FROM base as build
19+
COPY ./ /python-murfey/
1620
RUN apt-get update && \
1721
apt-get upgrade -y && \
1822
apt-get install -y --no-install-recommends \
@@ -22,24 +26,27 @@ RUN apt-get update && \
2226
net-tools \
2327
libpq-dev && \
2428
busybox --install && \
25-
rm -rf /var/lib/apt/lists/* && \
26-
groupadd -r -g "${groupid}" "${groupname}" && \
27-
useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \
2829
python -m venv /venv && \
29-
chown -R "${userid}":"${groupid}" /venv && \
30-
chmod -R a+x /venv
31-
ENV PATH=/venv/bin:$PATH
32-
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 \
30+
/venv/bin/python -m pip install --upgrade \
3731
pip \
3832
build \
3933
importlib-metadata &&\
40-
python -m pip install /python-murfey[client,instrument-server] && \
41-
chmod -R a+x /venv
34+
/venv/bin/python -m pip install /python-murfey[client,instrument-server]
35+
4236

43-
# Copy installed files across to final image
37+
# Transfer completed Murfey build to clean image
4438
FROM base
45-
COPY --from=build --chown="${userid}":"${groupid}" /venv/ /venv/
39+
40+
# Define external build arguments
41+
ARG groupid
42+
ARG groupname
43+
ARG userid
44+
45+
# Copy completed Murfey build across and set user and group permissions
46+
COPY --from=build /venv/ /venv/
47+
RUN groupadd -r -g "${groupid}" "${groupname}" && \
48+
useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \
49+
chown -R "${userid}":"${groupid}" /venv && \
50+
chmod -R a+x /venv
51+
ENV PATH=/venv/bin:$PATH
52+
USER "${userid}":"${groupid}"

Dockerfiles/murfey-server

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ ARG groupid
4545
ARG groupname
4646
ARG userid
4747

48-
# Copy completed Murfey build across, install Vim, and set user and group permissions
48+
# Copy completed Murfey build across and set user and group permissions
4949
COPY --from=build /venv/ /venv/
5050
RUN groupadd -r -g "${groupid}" "${groupname}" && \
5151
useradd -r -M "${groupname}" -u "${userid}" -g "${groupname}" && \

0 commit comments

Comments
 (0)