-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.worker
More file actions
51 lines (38 loc) · 1.25 KB
/
Dockerfile.worker
File metadata and controls
51 lines (38 loc) · 1.25 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
# stage 1: build
FROM python:3.10-slim-buster AS builder
# set up virtualenv
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# update pip
RUN apt-get update && \
apt-get install -y git && \
python3 -m pip install --upgrade pip
WORKDIR /app
COPY .git/ ./.git/
COPY .gitmodules/ .
COPY ./requirements.txt .
# define from where we need to load Optimos app
# 1) pull from the repository main branch
# RUN git submodule update --init --recursive
# 2) use local version of Optimos (under the path ./external_tools/roptimus-prime)
COPY external_tools/roptimus-prime external_tools/roptimus-prime
RUN pip install -r requirements.txt
RUN cd /app/external_tools/roptimus-prime && pip install -r requirements.txt
RUN cd /app/external_tools/roptimus-prime/ext_tools/Prosimos && pip install -r requirements.txt
RUN apt-get clean
# stage 2: run the flask app
FROM python:3.10-slim-buster
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=builder /opt/venv /opt/venv
COPY --from=builder /app/external_tools /app/external_tools
WORKDIR /app
COPY ./src ./src
COPY ./exts.py .
COPY ./factory.py .
COPY ./app.py .
COPY ./celery.sh .
RUN chmod -R 777 ./celery.sh
CMD [ "./celery.sh" ]