forked from art049/fastapi-odmantic-realworld-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
34 lines (25 loc) · 1017 Bytes
/
Dockerfile
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
FROM python:3.10-slim-buster as base
WORKDIR /app
COPY requirements.txt requirements.txt
# hadolint ignore=DL3042,DL3013
RUN pip install --upgrade pip && \
pip install -r requirements.txt
FROM base as prod
COPY src/ /app/
ENTRYPOINT ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]
FROM base as dev
# hadolint ignore=DL3008,DL3015
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && apt-get install -y --no-install-recommends git curl make && \
rm -rf /var/lib/apt/lists/*
COPY requirements-dev.txt requirements-dev.txt
# hadolint ignore=DL3042
RUN pip install -r requirements-dev.txt
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# hadolint ignore=DL3008,DL3015
RUN export DEBIAN_FRONTEND=noninteractive && \
curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && \
apt-get update && apt-get install -y --no-install-recommends nodejs && \
rm -rf /var/lib/apt/lists/*
COPY . /app/
ENTRYPOINT ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]