-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.bullseye
51 lines (41 loc) · 1.61 KB
/
Dockerfile.bullseye
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
# syntax=docker/dockerfile:1
# We use by default latest Python version, unless there is any
# requirement that is incompatible with it. In addition, `slim`
# ensures that everything is as small as possible (using Debian), for production
# use. We will use a multi-stage Dockerfile, in which firstly Orcha
# will be built and later on, it will use this as the base image
# for further runs to be faster and efficient.
ARG PYTHON_VERSION="3.11"
ARG BUILD_DEPENDENCIES="gcc"
ARG ORCHA_VERSION_FILE="dist/orcha_version"
ARG PYTHON_LIB="/usr/local"
FROM python:${PYTHON_VERSION}-bullseye AS build
ARG BUILD_DEPENDENCIES
ARG PYTHON_VERSION
ARG ORCHA_VERSION_FILE
# We will work at /tmp directory
WORKDIR /tmp
# The stages to follow are:
#
# 1. Install required dependencies
# 2. Install Orcha requirements
# 3. Build Orcha itself
# 4. Install Orcha in the system
# 5. From this base image, build the final Dockerfile
RUN apt-get update && apt-get install -y ${BUILD_DEPENDENCIES}
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir --prefix=/tmp/pylibs -r requirements.txt
# We now do the copy of the Orcha repository
COPY --link . .
# And prepare to build Orcha itself
RUN python setup.py bdist_wheel && \
echo "$(python3 setup.py --version)" > ${ORCHA_VERSION_FILE}
FROM python:${PYTHON_VERSION}-bullseye
ARG ORCHA_VERSION_FILE
ARG PYTHON_LIB
WORKDIR /app
COPY --from=build /tmp/dist/. dist/.
COPY --from=build /tmp/pylibs/. ${PYTHON_LIB}/.
RUN ORCHA_VERSION="$(cat ${ORCHA_VERSION_FILE})" && \
pip install --no-cache "dist/orcha-$ORCHA_VERSION-py3-none-any.whl"
ENTRYPOINT [ "orcha" ]