/
Dockerfile.api
60 lines (44 loc) · 1.34 KB
/
Dockerfile.api
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
FROM python:3.9-slim as base
ARG INSTALL_SLURM
ARG SLURM_VERSION
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
EXPOSE 8080
SHELL ["/bin/bash", "-c", "-l"]
RUN useradd -ms /bin/bash fastapi
USER root
RUN apt update
RUN apt install -y git
RUN pip install --upgrade pip
WORKDIR /tmp
RUN if [ "$INSTALL_SLURM" = "yes" ] ; \
then \
apt install -y munge && \
wget "https://download.schedmd.com/slurm/slurm-${SLURM_VERSION}.tar.bz2" && \
tar --bzip -x -f "slurm-${SLURM_VERSION}.tar.bz2" && \
cd "slurm-${SLURM_VERSION}" && \
./configure && \
make && \
make install ; \
else \
echo 'Slurm will not be installed.' ; \
fi
WORKDIR /home/fastapi/fastapi-celery
COPY . ./
########################## production #############################
FROM base as production
ARG WRAPPER_DEPS_INSTALL
ARG WRAPPER_DEPS_EXTRA
RUN chmod -R 0777 .
RUN chown -R fastapi:fastapi .
USER fastapi
RUN pip install osp-core ${WRAPPER_DEPS_INSTALL}
RUN pip install .[wrappers] ${WRAPPER_DEPS_EXTRA}
ENTRYPOINT ["./docker_entrypoint.sh"]
########################## development #############################
FROM base AS develop
ARG WRAPPER_DEPS_INSTALL
ARG WRAPPER_DEPS_EXTRA
RUN pip install osp-core ${WRAPPER_DEPS_INSTALL}
RUN pip install .[wrappers,tests,pre_commit] ${WRAPPER_DEPS_EXTRA}
WORKDIR /app