Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Split multi-stage build #35

Open
carneirofc opened this issue Mar 8, 2022 · 0 comments
Open

FIX: Split multi-stage build #35

carneirofc opened this issue Mar 8, 2022 · 0 comments
Assignees

Comments

@carneirofc
Copy link
Contributor

FROM base AS agilent4uhv
RUN set -x; cd scripts; make deploy-agilent4uhv
CMD ["/bin/bash", "-c", "set -e; cd scripts/; make run-agilent4uhv"]
FROM base AS countingpru
RUN set -x; cd scripts; make deploy-countingpru
CMD ["/bin/bash", "-c", "set -e; cd scripts/; make run-countingpru"]
FROM base AS mks937b
RUN set -x; cd scripts; make deploy-mks937b
CMD ["/bin/bash", "-c", "set -e; cd scripts/; make run-mks937b"]
FROM base AS rackMonitoring
RUN set -x; cd scripts; make deploy-rackmon
CMD ["/bin/bash", "-c", "set -e; cd scripts/; make run-rackmon"]
FROM base AS spixconv
COPY scripts scripts
RUN set -x; \
cd scrits; \
cp -v -p ./spixconv/ioc/autosave/* $(TOP)/autosave; \
cp -v -p ./spixconv/ioc/db/* $(TOP)/db; \
cp -v -p ./spixconv/ioc/protocol/* $(TOP)/protocol; \
cp -v -p ./spixconv/ioc/cmd/* $(TOP)/iocBoot/iocStreamDeviceIOC;

this approach is coupling different applications unnecessarily

The mks container approach seems better as it does not couple the build process.

ARG STREAM_BASE_IMAGE
ARG STREAM_BASE_TAG
FROM ${STREAM_BASE_IMAGE}:${STREAM_BASE_TAG}
COPY scripts scripts
RUN set -x; cd scripts; make deploy-mks937b
CMD ["/bin/bash", "-c", "set -e; cd scripts/; make run-mks937b"]

mks937b:
image: ${STREAM_BASE_IMAGE}:${MKS937B_TAG}
build:
dockerfile: 'Dockerfile.mks'
context: .
args:
STREAM_BASE_IMAGE: ${STREAM_BASE_IMAGE}
STREAM_BASE_TAG: ${STREAM_BASE_TAG}
labels:
br.com.lnls-sirius.commit: ${COMMIT_HASH}
br.com.lnls-sirius.device: "MKS937b"
volumes:
- "/var/tmp/auto:/opt/epics-R3.15.6/modules/StreamDevice-2.8.9/autosave:rw"

when building any container the initial action performed by the Makefile is a cleanup, if something goes wrong here things will go wild

build: build-epics update-env
make -C ./scripts
docker-compose build

build: clean build-agilent4uhv build-countingpru build-mbtemp build-mks937b build-rackmon build-spixconv

clean: clean-build clean-pyc clean-deploy
clean-deploy:
rm -rfv $(TOP)/iocBoot/iocStreamDeviceIOC/*.cmd
clean-build:
find -type f -name "*.cmd" -exec rm --verbose {} \;
rm -fr build/
rm -fr dist/
rm -fr .eggs/
find . -name '*.egg-info' -exec rm -fr {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc:
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -fr {} +

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants