-
Notifications
You must be signed in to change notification settings - Fork 0
/
DockerfileIronBank
52 lines (37 loc) · 1.77 KB
/
DockerfileIronBank
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
FROM docker.jackpinetech.com/ironbank/redhat/python/python39:latest AS base
ENV SRC_DIR=/opt/app-root/src
ENV DIST_DIR=$SRC_DIR/dist
ENV PACKAGES_DIR=$DIST_DIR/build/packages
RUN mkdir -p $PACKAGES_DIR \
&& mkdir -p $DIST_DIR \
&& echo '#!/bin/sh' > /opt/app-root/src/entrypoint.sh \
&& echo 'export LC_ALL=C.UTF-8' >> /opt/app-root/src/entrypoint.sh \
&& echo 'exec "$@"' >> /opt/app-root/src/entrypoint.sh \
&& chmod +x /opt/app-root/src/entrypoint.sh
FROM docker.jackpinetech.com/ironbank/redhat/python/python39:latest AS build
ENV SRC_DIR=/opt/app-root/src
ENV DIST_DIR=$SRC_DIR/dist
ENV PACKAGES_DIR=$DIST_DIR/build/packages
RUN mkdir -p $PACKAGES_DIR \
&& mkdir -p $DIST_DIR \
&& /opt/app-root/bin/python3 -m pip install pip --upgrade \
&& /opt/app-root/bin/python3 -m pip install build
WORKDIR $SRC_DIR
COPY . $SRC_DIR/
# Update and install packages, create directories, install pycons3rt3 and pyhomer3
RUN python3 -m build \
&& mkdir -p PACKAGES_DIR \
&& /opt/app-root/bin/python3 -m pip download pip --dest $PACKAGES_DIR \
&& /opt/app-root/bin/python3 -m pip download --requirement requirements.txt --dest $PACKAGES_DIR
FROM base AS final
COPY --from=build $PACKAGES_DIR/* $PACKAGES_DIR/
COPY --from=build $DIST_DIR/*.whl $DIST_DIR/
RUN /opt/app-root/bin/python3 -m pip install $PACKAGES_DIR/pip* \
&& /opt/app-root/bin/python3 -m pip install $PACKAGES_DIR/* \
&& /opt/app-root/bin/python3 -m pip install $DIST_DIR/*.whl \
&& rm -Rf $PACKAGES_DIR \
&& rm -Rf $DIST_DIR
ENTRYPOINT ["/opt/app-root/src/entrypoint.sh"]
CMD ["cons3rt", "--version"]
# docker build -f DockerfileIronBank -t pycons3rt3:0.0.28a0-iron .
# docker run --rm -it -v $PYCONS3RT_HOME:/opt/app-root/src/.cons3rt pycons3rt3:0.0.28a0-iron cons3rt cloud list