Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 36 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ image-pull-tag-push-debian:
docker pull debian:$(IMG_DEBIAN_TAG)
docker tag debian:$(IMG_DEBIAN_TAG) ghcr.io/lnls-sirius/docker-machine-applications/debian:$(IMG_DEBIAN_TAG) && \
docker push ghcr.io/lnls-sirius/docker-machine-applications/debian:$(IMG_DEBIAN_TAG)
image-pull-tag-push-debian-models:
docker pull debian:$(IMG_DEBIAN_MODELS_TAG)
docker tag debian:$(IMG_DEBIAN_MODELS_TAG) ghcr.io/lnls-sirius/docker-machine-applications/debian:$(IMG_DEBIAN_MODELS_TAG) && \
docker push ghcr.io/lnls-sirius/docker-machine-applications/debian:$(IMG_DEBIAN_MODELS_TAG)

# time: 4m0s @ 10.0.38.42
image-build-fac-python: image-cleanup dockerfiles-create image-pull-tag-push-debian

image-build-fac-python: image-cleanup dockerfiles-create \
image-pull-tag-push-debian
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.python > ./deploy-files/Dockerfile.python
docker build -f ./deploy-files/Dockerfile.python \
$(BUILD_CACHE) \
Expand All @@ -44,7 +49,6 @@ image-build-fac-python: image-cleanup dockerfiles-create image-pull-tag-push-deb
. -t ghcr.io/lnls-sirius/docker-machine-applications/fac-python:$(DEPLOY_TAG) && \
docker push ghcr.io/lnls-sirius/docker-machine-applications/fac-python:$(DEPLOY_TAG)

# time: 1m11s @ 10.0.38.42
image-build-fac-epics: dockerfiles-create
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.epics > ./deploy-files/Dockerfile.epics
docker build -f ./deploy-files/Dockerfile.epics \
Expand All @@ -56,7 +60,7 @@ image-build-fac-epics: dockerfiles-create
. -t ghcr.io/lnls-sirius/docker-machine-applications/fac-epics:$(DEPLOY_TAG) && \
docker push ghcr.io/lnls-sirius/docker-machine-applications/fac-epics:$(DEPLOY_TAG)

# time: 4m5s @ 10.0.38.42

image-build-fac-deps: dockerfiles-create
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.deps > ./deploy-files/Dockerfile.deps
docker build -f ./deploy-files/Dockerfile.deps \
Expand All @@ -66,7 +70,7 @@ image-build-fac-deps: dockerfiles-create
. -t ghcr.io/lnls-sirius/docker-machine-applications/fac-deps:$(DEPLOY_TAG) && \
docker push ghcr.io/lnls-sirius/docker-machine-applications/fac-deps:$(DEPLOY_TAG)

# time: 1m59s @ 10.0.38.42

image-build-fac-iocs: image-cleanup dockerfiles-create
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.iocs > ./deploy-files/Dockerfile.iocs
docker build -f ./deploy-files/Dockerfile.iocs \
Expand All @@ -76,8 +80,31 @@ image-build-fac-iocs: image-cleanup dockerfiles-create
. -t ghcr.io/lnls-sirius/docker-machine-applications/fac-iocs:$(DEPLOY_TAG)
# docker push ghcr.io/lnls-sirius/docker-machine-applications/fac-iocs:$(DEPLOY_TAG)

# time: 4m45s @ 10.0.38.42
image-build-fac-iocs-li-ps: image-cleanup dockerfiles-create image-pull-tag-push-debian
image-build-fac-models-deps: dockerfiles-create
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.models-deps > ./deploy-files/Dockerfile.models-deps
docker build -f ./deploy-files/Dockerfile.models-deps \
$(BUILD_CACHE) \
--build-arg IMG_DEBIAN_MODELS_TAG=$(IMG_DEBIAN_MODELS_TAG) \
--build-arg CACHE_BREAKER=$$(date +%s) \
--label "br.com.lnls-sirius.department=FAC" \
. -t ghcr.io/lnls-sirius/docker-machine-applications/fac-models-deps:$(DEPLOY_TAG)
# docker push ghcr.io/lnls-sirius/docker-machine-applications/fac-models-deps:$(DEPLOY_TAG)


image-build-fac-models-iocs: image-cleanup dockerfiles-create
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.models-iocs > ./deploy-files/Dockerfile.models-iocs
docker build -f ./deploy-files/Dockerfile.models-iocs \
$(BUILD_CACHE) \
--build-arg IMG_DEPS_MODELS_TAG=$(IMG_DEPS_MODELS_TAG) \
--build-arg CACHE_BREAKER=$$(date +%s) \
--label "br.com.lnls-sirius.department=FAC" \
. -t ghcr.io/lnls-sirius/docker-machine-applications/fac-models-iocs:$(DEPLOY_TAG)
# docker push ghcr.io/lnls-sirius/docker-machine-applications/fac-models-iocs:$(DEPLOY_TAG)



image-build-fac-iocs-li-ps: image-cleanup dockerfiles-create \
image-pull-tag-push-debian
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.python2 > ./deploy-files/Dockerfile.python2
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.epics-python2 > ./deploy-files/Dockerfile.epics-python2
python3 ./tools/replace_versions.py ./deploy-files/REPLACE-RULES dockerfile-templates/Dockerfile.iocs-li-ps > ./deploy-files/Dockerfile.iocs-li-ps
Expand Down Expand Up @@ -110,6 +137,8 @@ image-runbash-fac-deps:

image-runbash-fac-iocs:
docker run -it --rm --network host ghcr.io/lnls-sirius/docker-machine-applications/fac-iocs:$(DEPLOY_TAG)
image-runbash-fac-models-iocs:
docker run -it --rm --network host ghcr.io/lnls-sirius/docker-machine-applications/fac-models-iocs:$(DEPLOY_TAG)

image-runbash-fac-iocs-li-ps:
docker run -it --rm --network host ghcr.io/lnls-sirius/docker-machine-applications/fac-iocs-li-ps:$(DEPLOY_TAG)
Expand Down
87 changes: 87 additions & 0 deletions dockerfile-templates/Dockerfile.models-deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
ARG IMG_DEBIAN_MODELS_TAG
FROM ghcr.io/lnls-sirius/docker-machine-applications/debian:${IMG_DEBIAN_MODELS_TAG}
# --- size 117 MB

SHELL ["bash", "-c"]
WORKDIR /opt/mamba_files

ENV DEBIAN_FRONTEND=noninteractive \
TZ=America/Sao_Paulo

# -------------------------------------------------------------------
# 1) Install apt packages (cleaned in the same layer)
# -------------------------------------------------------------------
RUN apt-get update && \
apt-get install -y --no-install-recommends \
tzdata procps wget iproute2 iputils-ping \
libreadline-dev git nano bzip2 ca-certificates && \
ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \
dpkg-reconfigure --frontend noninteractive tzdata && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /usr/share/doc/* /usr/share/man/*
# --- size 256 MB

# -------------------------------------------------------------------
# 2) Install micromamba (single static binary, very small)
# -------------------------------------------------------------------
RUN wget -qO- https://micro.mamba.pm/api/micromamba/linux-64/latest | \
tar -xvj bin/micromamba && \
mv bin/micromamba /usr/local/bin/ && \
rm -rf bin

ENV MAMBA_ROOT_PREFIX=/opt/mamba_files/mamba
RUN mkdir -p $MAMBA_ROOT_PREFIX
# --- size 273 MB


# -------------------------------------------------------------------
# 3) Create 'sirius' environment with Python 3.9
# -------------------------------------------------------------------
RUN micromamba create -y -n sirius -c conda-forge python=3.9

# Convenience link for python
RUN ln -s /opt/mamba_files/mamba/envs/sirius/bin/python3 \
/opt/mamba_files/mamba/envs/sirius/bin/python-sirius
# --- size 1.29 GB


# -------------------------------------------------------------------
# 4) Install packages into the 'sirius' environment
# No activation required — micromamba run does it automatically.
# -------------------------------------------------------------------

# First package block
RUN micromamba install -y -n sirius -c conda-forge \
gxx make binutils swig=4.2.0 gsl libblas \
bottleneck aiohttp numpy=1.23 && \
micromamba clean --all --yes
# --- size 2.34 GB

# EPICS block
RUN micromamba install -y -n sirius -c conda-forge \
epics-base=3.15.6 pyepics=3.5.7 pcaspy==0.7.3 && \
micromamba clean --all --yes
# --- size 2.45 GB

# Scientific Python packages block
RUN micromamba install -y -n sirius -c conda-forge \
libxcrypt fftw pyparsing \
scipy matplotlib-base \
pytest mpmath entrypoints requests pandas \
numexpr sh pywavelets scikit-image \
scikit-learn pydocstyle pycodestyle pylama \
openpyxl gpy gpyopt fpdf sympy \
h5py scienceplots seaborn-base lzstring && \
micromamba clean --all --yes
# --- size 3.12 GB

# # Scientific Python packages block (pycollef)
# RUN micromamba install -y -n sirius -c conda-forge \
# fftw mpmath && \
# micromamba clean --all --yes

# -------------------------------------------------------------------
# 5) Final system cleanup
# -------------------------------------------------------------------
RUN rm -rf /usr/share/doc/* /usr/share/man/* /usr/share/locale/*
# --- size 3.12 GB
42 changes: 42 additions & 0 deletions dockerfile-templates/Dockerfile.models-iocs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ARG IMG_DEPS_MODELS_TAG
FROM ghcr.io/lnls-sirius/docker-machine-applications/fac-models-deps:${IMG_DEPS_MODELS_TAG}
# --- size 3.12 GB

SHELL ["bash", "-c"]

WORKDIR /opt/repos

# -------------------------------------------------------------------
# 1) Clone trackcpp and install inside sirius env
# -------------------------------------------------------------------
RUN git clone https://github.com/lnls-fac/trackcpp.git && \
micromamba run -n sirius bash -c "cd trackcpp && make install && make clean"
# --- size 3.13 GB

# -------------------------------------------------------------------
# 2) Clone repos (no build yet)
# -------------------------------------------------------------------
RUN git clone https://github.com/lnls-fac/mathphys.git && \
git clone https://github.com/lnls-fac/pyaccel.git && \
git clone https://github.com/lnls-fac/pymodels.git && \
git clone https://github.com/lnls-sirius/dev-packages.git && \
git clone https://github.com/lnls-sirius/machine-applications-models.git
# --- size 3.17 GB

# -------------------------------------------------------------------
# 3) Build all packages inside micromamba environment
# -------------------------------------------------------------------
RUN micromamba run -n sirius bash -c "cd mathphys && \
git checkout add-flatten && \
make install" && \
micromamba run -n sirius bash -c "cd dev-packages/siriuspy && \
make install" && \
micromamba run -n sirius bash -c "cd pyaccel && \
make install" && \
micromamba run -n sirius bash -c "cd pymodels && \
git checkout substitute-flatten && \
make install" && \
micromamba run -n sirius bash -c "cd machine-applications-models && \
git checkout add-si-ap-injbeamdiag && \
make install"
# --- size 3.17 GB
17 changes: 11 additions & 6 deletions tags.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ FILES_SERVER_URL ?= http://10.0.38.42/download/lnls-ansible
# tag with EPICS base version
EPICS_BASE_TAG ?= base-3.15.6

# tags used for creating docker images
IMG_DEBIAN_TAG ?= bullseye-20211011
#DEPLOY_TAG ?= 2025-04-23
DEPLOY_TAG ?= 2025-04-28_16-00-00
DEPLOY_TAG ?= 2025-11-04

# --- image for IOCs ---

# image tags used for starting docker services
IMG_DEBIAN_TAG ?= bullseye-20211011
IMG_IOCS_LI_PS_TAG ?= 2025-04-23
IMG_PYTHON_TAG ?= 2025-04-23 # also used as base image for fac-epics
IMG_PYTHON_TAG ?= 2025-04-23
IMG_EPICS_TAG ?= 2025-04-23
IMG_DEPS_TAG ?= 2025-04-23
IMG_IOCS_TAG ?= $(DEPLOY_TAG)

# --- image for IOCs with models packages ---

IMG_DEBIAN_MODELS_TAG ?= bookworm-20251020
IMG_DEPS_MODELS_TAG ?= 2025-11-04
IMG_IOCS_MODELS_TAG ?= $(DEPLOY_TAG)