File size: 860 Bytes
29963c4
 
 
 
 
 
 
 
 
 
bd6f953
29963c4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3-alpine AS base

# Image to Build Dependencies
FROM base AS builder

WORKDIR /usr/src/app

COPY ./requirements.txt /usr/src/app

# Build Dependencies
RUN apk --no-cache add gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++ cargo rust python3-dev build-essential

# Python Dependencies
RUN pip install --no-cache-dir --prefix=/install wheel cryptography gunicorn pymysql
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt

# Runtime Environment Image
FROM base

WORKDIR /usr/src/app

# Runtime Dependencies
RUN apk --no-cache add libxml2 libxslt
COPY --from=builder /install /usr/local

COPY . .

RUN flask db init \
  && flask db migrate \
  && flask db upgrade

CMD flask db stamp head \
  && flask db migrate \
  && flask db upgrade \
  && gunicorn -b 0.0.0.0:5000 -w 4 yotter:app

EXPOSE 5000