tutor/Dockerfile

42 lines
884 B
Docker
Raw Normal View History

2021-07-08 01:48:58 +00:00
FROM python:3.9.6-alpine3.13 as base
WORKDIR /app
FROM base as builder
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VERSION=1.1.4
RUN apk add --no-cache gcc libffi-dev musl-dev openssl-dev rust cargo
RUN pip install "poetry==$POETRY_VERSION"
RUN python -m venv /venv
COPY pyproject.toml poetry.lock ./
RUN poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin
COPY . .
RUN poetry build && /venv/bin/pip install dist/*.whl
FROM base as frontend
RUN apk add --no-cache make npm
COPY www /www
RUN make -C /www
FROM base as final
EXPOSE 8888
ENV TUTOR_PORT=8888 \
TUTOR_DATABASE=/tutor.db \
TUTOR_STATIC=/www/public
RUN apk add sqlite
COPY --from=builder /venv /venv
COPY --from=frontend /www /www
COPY docker-entrypoint.sh tables.sql ./
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["server"]