-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
59 lines (40 loc) · 1.19 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
54
55
56
57
58
59
# base
FROM python:3.11-alpine3.17 AS base
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1
WORKDIR /app
RUN apk add --no-cache \
gcc \
libffi-dev \
musl-dev
# node-builder
FROM node:18-alpine3.17 AS node-builder
WORKDIR /app
COPY vocexcel-ui/ .
RUN npm ci
RUN npm run build
# python-builder
FROM base AS python-builder
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1
RUN pip install poetry
ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY pyproject.toml poetry.lock ./
RUN poetry export -f requirements.txt --with web | pip install -r /dev/stdin
COPY . .
COPY --from=node-builder /app/dist /app/vocexcel/web/static
RUN poetry build && pip install dist/*.whl
# final
FROM base as final
COPY --from=node-builder /app/dist /vocexcel-ui
COPY --from=python-builder /opt/venv /opt/venv
ENV VIRTUALENV=/opt/venv \
PATH=/opt/venv/bin:${PATH} \
VOCEXCEL_WEB_STATIC_DIR=/opt/venv/lib/python3.11/site-packages/vocexcel/web/static
RUN apk --no-cache add bash
USER 1000
CMD [ "uvicorn", "vocexcel.web.app:create_app", "--host=0.0.0.0", "--port=8000", "--proxy-headers" ]