-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (64 loc) · 3.5 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# This is intended to run in Local Development (dev) and Github Actions (test/prod)
# BUILD_ENV options (dev, test, prod) dev for local testing and test for github actions testing on prod ready code
ARG BUILD_ENV="prod"
ARG MAINTAINER="[email protected];"
ARG BIFROST_COMPONENT_NAME="bifrost_run_launcher"
#---------------------------------------------------------------------------------------------------
# Base for dev environement
#---------------------------------------------------------------------------------------------------
FROM continuumio/miniconda3:22.11.1 as build_dev
ONBUILD ARG BIFROST_COMPONENT_NAME
ONBUILD COPY /components/${BIFROST_COMPONENT_NAME} /bifrost/components/${BIFROST_COMPONENT_NAME}
ONBUILD COPY /lib/bifrostlib /bifrost/lib/bifrostlib
ONBUILD WORKDIR /bifrost/components/${BIFROST_COMPONENT_NAME}/
ONBUILD RUN \
pip install -r requirements.txt; \
pip install --no-cache -e file:///bifrost/lib/bifrostlib; \
pip install --no-cache -e file:///bifrost/components/${BIFROST_COMPONENT_NAME}/
#---------------------------------------------------------------------------------------------------
# Base for production environment
#---------------------------------------------------------------------------------------------------
FROM continuumio/miniconda3:22.11.1 as build_prod
ONBUILD ARG BIFROST_COMPONENT_NAME
ONBUILD WORKDIR /bifrost/components/${BIFROST_COMPONENT_NAME}
ONBUILD COPY ./ ./
ONBUILD RUN \
pip install -r requirements.txt; \
pip install file:///bifrost/components/${BIFROST_COMPONENT_NAME}/
#---------------------------------------------------------------------------------------------------
# Base for test environment (prod with tests)
#---------------------------------------------------------------------------------------------------
#---------------------------------------------------------------------------------------------------
FROM continuumio/miniconda3:22.11.1 as build_test
ONBUILD ARG BIFROST_COMPONENT_NAME
ONBUILD WORKDIR /bifrost/components/${BIFROST_COMPONENT_NAME}
ONBUILD COPY ./ ./
ONBUILD RUN \
pip install -r requirements.txt \
pip install file:///bifrost/components/${BIFROST_COMPONENT_NAME}/
#---------------------------------------------------------------------------------------------------
# Details
#---------------------------------------------------------------------------------------------------
FROM build_${BUILD_ENV}
ONBUILD ARG BIFROST_COMPONENT_NAME
ONBUILD ARG BUILD_ENV
ONBUILD ARG MAINTAINER
LABEL \
BIFROST_COMPONENT_NAME=${BIFROST_COMPONENT_NAME} \
description="Docker environment for ${BIFROST_COMPONENT_NAME}" \
environment="${BUILD_ENV}" \
maintainer="${MAINTAINER}"
#---------------------------------------------------------------------------------------------------
# Additional programs for all environments
#---------------------------------------------------------------------------------------------------
# N/A
#---------------------------------------------------------------------------------------------------
# Additional resources
#---------------------------------------------------------------------------------------------------
# N/A
#---------------------------------------------------------------------------------------------------
# Run and entry commands
#---------------------------------------------------------------------------------------------------
WORKDIR /bifrost/components/${BIFROST_COMPONENT_NAME}
ENTRYPOINT ["python3", "-m", "bifrost_run_launcher"]
CMD ["python3", "-m", "bifrost_run_launcher", "--help"]