generated from Neoteroi/BlackSheep-Azure-API
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
53 lines (50 loc) · 1.52 KB
/
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# Build the UI
FROM node:14.18.1-stretch-slim AS ui_builder
WORKDIR /home
ADD ./ui /home
RUN yarn install && yarn build
# Build the Server
FROM python:3.10.1-slim as server_builder
WORKDIR /home
RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
RUN apt-get update && apt-get install make \
apt-utils \
lsb-release \
software-properties-common \
apt-transport-https \
ca-certificates \
gnupg \
sqlite3 \
build-essential \
libssl-dev \
zlib1g-dev \
libbz2-dev \
libsqlite3-dev \
unixodbc-dev \
libncurses5-dev \
libgdbm-dev \
libnss3-dev \
libreadline-dev \
libffi-dev \
libjpeg-dev \
zlib1g-dev \
wget
ADD ./server /home
RUN mkdir -p /home/app/static
COPY --from=ui_builder /home/build/ /home/app/static/
RUN python -m venv venv && . venv/bin/activate && pip install --upgrade pip && pip install -r requirements.txt
# Create a SQLite database anyway with the right structure (thanks to Alembic)
RUN rm -f torino.db && . venv/bin/activate && DB_MIGCONNSTRING="sqlite:///./torino.db" alembic upgrade head
FROM python:3.10.1-slim
WORKDIR /home
COPY --from=server_builder /home/ /home/
# By default, set the app environment to be "local"
ENV APP_ENV=local
RUN echo "APT::Get::Assume-Yes \"true\";" > /etc/apt/apt.conf.d/90assumeyes
RUN apt-get update && apt-get install \
ca-certificates \
sqlite3 \
libsqlite3-dev \
libjpeg-dev \
zlib1g-dev
CMD . venv/bin/activate && uvicorn server:app --host 0.0.0.0 --port 80 --log-level info