Skip to content

Commit

Permalink
Fix issue with python install
Browse files Browse the repository at this point in the history
Switched to epics-containers epics-base-developer:7.0.8ec2
Added pcas build
Used python and compilers from epics-base developer stage
Updated to latest (pinned) dockerize python module
  • Loading branch information
gilesknap committed Jul 26, 2024
1 parent aa6d76a commit 3d186fe
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,28 @@
FROM alpine AS download-extract

RUN apk update && apk add git
RUN git clone --branch R2-1-2-0 --depth 1 -c advice.detachedHead=false \
RUN git clone --branch R2-1-3-0 --depth 1 -c advice.detachedHead=false \
https://github.com/epics-extensions/ca-gateway.git /ca-gateway
RUN rm -rf /ca-gateway/.git
RUN git clone --branch v4.13.3 --depth 1 -c advice.detachedHead=false \
https://github.com/epics-modules/pcas.git /epics/support/pcas

RUN rm -rf /ca-gateway/.git; rm -rf /epics/support/pcas/.git


## ===============================
# 2nd stage: build the CA Gateway
FROM pklaus/epics_base:7.0.4_debian AS builder

# The scs user already exists in base image.
# We set it here explicitly to clarify file ownership.
USER scs
FROM ghcr.io/epics-containers/epics-base-developer:7.0.8ec2 AS builder

# Download the EPICS CA Gateway
COPY --chown=scs:users --from=download-extract /ca-gateway /epics/src/ca-gateway
COPY --from=download-extract /ca-gateway /epics/src/ca-gateway
COPY --from=download-extract /epics/support/pcas /epics/support/pcas

RUN cd /epics/support/pcas \
&& echo "EPICS_BASE=/epics/epics-base" > configure/RELEASE.local \
&& make -j$(nproc)
RUN cd /epics/src/ca-gateway \
&& echo "EPICS_BASE=/epics/base" > configure/RELEASE.local \
&& echo "PCAS=/epics/base/modules/pcas" >> configure/RELEASE.local \
&& echo "EPICS_BASE=/epics/epics-base" > configure/RELEASE.local \
&& echo "PCAS=/epics/support/pcas" >> configure/RELEASE.local \
&& echo "INSTALL_LOCATION=/epics/ca-gateway" > configure/CONFIG_SITE.local \
&& make -j$(nproc)

Expand All @@ -30,14 +34,13 @@ RUN cd /epics/src/ca-gateway \
# to a new root folder. For more information, read
# https://blog.oddbit.com/post/2015-02-05-creating-minimal-docker-images/
FROM builder AS dockerizer
USER root

# Install Python and a Python2 compatible version of larsks/dockerize
RUN apt-get update && apt-get install -yq python python-pip rsync \
&& pip install https://github.com/larsks/dockerize/archive/a903419.zip
# Install the latest commit of dockerize (2021/07/06)
RUN pip install git+https://github.com/larsks/dockerize@024b1a2

# Move the executable "gateway" to a more prominent location
RUN mv /epics/ca-gateway/bin/*/gateway /epics/
RUN useradd scs

# Dockerize
RUN dockerize -L preserve -n -u scs -o /ca-gateway_root --verbose /epics/gateway \
Expand All @@ -53,6 +56,7 @@ ENTRYPOINT ["/epics/gateway"]
# from scratch for minimal size.
FROM scratch AS final

# User scs gives us a non-root user to run the gateway
USER scs

COPY --from=dockerizer /ca-gateway_root /
Expand Down

0 comments on commit 3d186fe

Please sign in to comment.