Skip to content

Commit

Permalink
ioc: add stage without IOC building.
Browse files Browse the repository at this point in the history
This allows us to run an IOC which was built along with its support
module. This pattern is used for some community modules, including
motor's and areaDetector's ones.

A new (empty) stage has been created only to specify the base image in
the COPY command, since `--from` argument does not support variable
expansion [1].

`build-stage` has been moved below `no-build` stage, so bad multi-stage
resolvers won't fail for the new stage.

[1]: https://forums.docker.com/t/how-can-i-expand-a-variable-within-a-copy-command-in-the-dockerfile/113538/2
  • Loading branch information
henriquesimoes committed Sep 13, 2023
1 parent d240ed0 commit 30a9e5f
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
ARG DEBIAN_VERSION=11.7

FROM ghcr.io/cnpem/lnls-debian-11-epics-7:v0.3.0 AS build-stage
FROM ghcr.io/cnpem/lnls-debian-11-epics-7:v0.3.0 AS build-image

ARG REPONAME
ARG BUILD_PACKAGES

RUN if [ -n "$BUILD_PACKAGES" ]; then apt update && apt install $BUILD_PACKAGES; fi

WORKDIR /opt/${REPONAME}

COPY . .

RUN cp /opt/epics/RELEASE configure/RELEASE
RUN rm -rf .git/


FROM debian:${DEBIAN_VERSION}-slim as base
FROM debian:${DEBIAN_VERSION}-slim AS base

ARG RUNDIR
ARG ENTRYPOINT=/bin/bash
Expand All @@ -38,6 +25,26 @@ RUN ln -s ${ENTRYPOINT} ./entrypoint
ENTRYPOINT ["./entrypoint"]


FROM base AS no-build

COPY --from=build-image /opt /opt


FROM build-image AS build-stage

ARG REPONAME
ARG BUILD_PACKAGES

RUN if [ -n "$BUILD_PACKAGES" ]; then apt update && apt install $BUILD_PACKAGES; fi

WORKDIR /opt/${REPONAME}

COPY . .

RUN cp /opt/epics/RELEASE configure/RELEASE
RUN rm -rf .git/


FROM build-stage AS dynamic-build

ARG JOBS=1
Expand Down

0 comments on commit 30a9e5f

Please sign in to comment.