45 lines
1.1 KiB
Docker
45 lines
1.1 KiB
Docker
FROM python:3.9.6-alpine3.14 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 curl
|
|
COPY www /www
|
|
RUN curl -sL --output elm.gz https://github.com/elm/compiler/releases/download/0.19.1/binary-for-linux-64-bit.gz \
|
|
&& gunzip elm.gz \
|
|
&& chmod +x elm \
|
|
&& cd /www \
|
|
&& /app/elm make /www/src/App.elm --output /www/public/elm.js
|
|
|
|
FROM base as final
|
|
|
|
EXPOSE 8888
|
|
|
|
ENV TUTOR_PORT=8888 \
|
|
TUTOR_DATABASE=/tutor.db \
|
|
TUTOR_STATIC=/www
|
|
|
|
RUN apk add sqlite
|
|
COPY --from=builder /venv /venv
|
|
COPY --from=frontend /www/public /www
|
|
COPY docker-entrypoint.sh tables.sql ./
|
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|
|
CMD ["server"]
|