-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (37 loc) · 1.23 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
FROM python:slim as build
LABEL name="Interactive FREEQO"
LABEL version="1.0"
LABEL description="An interactive webapp to play with FREEQO"
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
#INSTALLS
RUN apt-get update && \
apt-get install -y --no-install-recommends nodejs npm musl-dev g++
# copy files
COPY client /opt/dist/client
COPY requirements.txt /opt/dist/
COPY *.py /opt/dist/
WORKDIR /opt/dist/client
RUN rm -rf node_modules package-lock.json
RUN (npm install && npm rebuild node-sass && npm run build) & \
(pip wheel --no-cache-dir --no-deps --wheel-dir /wheels -r ../requirements.txt) ; \
wait
# Slim Rebuild
FROM python:slim
LABEL name="Interactive FREEQO"
LABEL version="1.0"
LABEL description="An interactive webapp to play with FREEQO"
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV API_PORT 8080
EXPOSE $API_PORT
WORKDIR /opt/dist
COPY --from=build /wheels /wheels
COPY --from=build /opt/dist/client /opt/dist/client
COPY --from=build /opt/dist/*.py ./
COPY --from=build /opt/dist/requirements.txt .
COPY --from=build /opt/dist/static /opt/dist/static
RUN pip install --no-cache /wheels/*
CMD flask --app Main.py run --port $API_PORT --host 0.0.0.0