forked from docat-org/docat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (44 loc) · 1.46 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
# building frontend
FROM node:16.14 as build-deps
COPY web ./
# fix docker not following symlinks
COPY doc/getting-started.md ./src/assets/
RUN yarn install --frozen-lockfile
RUN yarn lint
RUN yarn run test:unit
RUN yarn build
# setup Python
FROM python:3.10.2-alpine3.15 AS backend
# configure docker container
ENV PYTHONDONTWRITEBYTECODE=1 \
# make poetry create the virtual environment in the project's root
# it gets named `.venv`
POETRY_VIRTUALENVS_IN_PROJECT=true \
# do not ask any interactive question
POETRY_NO_INTERACTION=1
RUN apk update && \
apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo
RUN pip install poetry==1.1.13
COPY /docat/pyproject.toml /docat/poetry.lock /app/
# Install the application
WORKDIR /app/docat
RUN poetry install --no-root --no-ansi --no-dev
# production
FROM python:3.10.2-alpine3.15
# set up the system
RUN apk update && \
apk add nginx dumb-init && \
rm -rf /var/cache/apk/*
RUN mkdir -p /etc/nginx/locations.d
RUN mkdir -p /var/docat/doc
RUN chown -R nginx /var/docat /etc/nginx/locations.d
# install the application
RUN mkdir -p /var/www/html
COPY --from=build-deps /dist /var/www/html
COPY docat /app/docat
WORKDIR /app/docat
RUN cp docat/nginx/default /etc/nginx/http.d/default.conf
# Copy the build artifact (.venv)
COPY --from=backend /app /app/docat
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["sh", "-c", "nginx && .venv/bin/python -m uvicorn --host 0.0.0.0 --port 5000 docat.app:app"]