-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
83 lines (59 loc) · 2.11 KB
/
Copy pathDockerfile
File metadata and controls
83 lines (59 loc) · 2.11 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
# BUILDER IMAGE
FROM artifactory.cnes.fr/hysope2-docker/hys2/python-slim:3.8-slim as build
USER 0
WORKDIR /app
# copy necessary files
COPY pyproject.toml ./
COPY py_hydroweb/ py_hydroweb/
# install temporary required packages
RUN --mount=type=secret,id=secret \
--mount=type=cache,target=/var/cache/buildkit/pip \
set -eux ; \
[ -e /run/secrets/secret ] && . /run/secrets/secret ; \
[ -e /kaniko/run/secrets/secret ] && . /kaniko/run/secrets/secret ; \
pip install --upgrade pip ; \
pip install --no-cache-dir . ;
USER user
# TEST IMAGE
FROM build as test
ENV PIP_CACHE_DIR=/var/cache/buildkit/pip
USER 0
# copy necessary files
WORKDIR /app
COPY tests ./tests
COPY setup.cfg setup.cfg
# install make and tests deps
RUN --mount=type=secret,id=secret \
--mount=type=cache,target=/var/cache/buildkit/pip \
set -eux ; \
[ -e /run/secrets/secret ] && . /run/secrets/secret ; \
[ -e /kaniko/run/secrets/secret ] && . /kaniko/run/secrets/secret ; \
apt-get update ; \
apt-get install --no-install-recommends -y make ; \
pip install --upgrade pip ; \
pip install .[dev] ;
COPY --from=artifactory.cnes.fr/hysope2-docker/hys2/dockerfile-custom-stages:latest python-ci-env-stage/Makefile Makefile
ENTRYPOINT []
# DEV CONTAINER IMAGE
FROM test as dev
ENV MODULES_DIRECTORIES="py_hydroweb"
USER 0
COPY --from=artifactory.cnes.fr/hysope2-docker/hys2/dockerfile-custom-stages:latest python-dev-env-stage/ /tmp/
RUN --mount=type=secret,id=secret \
--mount=type=cache,target=/var/cache/apt \
set -eux ; \
[ -e /run/secrets/secret ] && . /run/secrets/secret ; \
[ -e /kaniko/run/secrets/secret ] && . /kaniko/run/secrets/secret ; \
/tmp/install-script.sh ;
USER user
ENTRYPOINT [ "/docker-entrypoint.sh" ]
CMD ["bash"]
# ----------------------------
# IMAGE PUBLICATION (Define and copy files for publication)
FROM artifactory.cnes.fr/hysope2-docker/hys2/python-slim:3.8-slim-publier AS publication
USER 0
ARG TWINE_REPOSITORY_URL
ARG TWINE_CERT=/etc/ssl/certs/ca-certificates.trust.crt
COPY py_hydroweb/ py_hydroweb/
COPY pyproject.toml pyproject.toml
COPY README.md README.md