2021-07-08 01:48:58 +00:00
|
|
|
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
|
|
|
|
|
2022-07-28 03:09:27 +00:00
|
|
|
RUN apk add --no-cache build-base libffi-dev musl-dev openssl-dev rust cargo yajl-dev
|
2021-07-08 01:48:58 +00:00
|
|
|
RUN pip install "poetry==$POETRY_VERSION"
|
|
|
|
RUN python -m venv /venv
|
|
|
|
|
|
|
|
COPY pyproject.toml poetry.lock ./
|
2022-07-28 03:09:27 +00:00
|
|
|
RUN poetry export \
|
|
|
|
--format requirements.txt \
|
|
|
|
--without-hashes \
|
|
|
|
| /venv/bin/pip install -r /dev/stdin
|
2021-07-08 01:48:58 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-07-28 03:30:24 +00:00
|
|
|
RUN apk add yajl
|
2021-07-08 01:48:58 +00:00
|
|
|
COPY --from=builder /venv /venv
|
|
|
|
COPY --from=frontend /www/public /www
|
|
|
|
COPY docker-entrypoint.sh tables.sql ./
|
|
|
|
ENTRYPOINT ["./docker-entrypoint.sh"]
|
|
|
|
CMD ["server"]
|