tutor/Dockerfile

51 lines
1.2 KiB
Docker
Raw Permalink Normal View History

2023-07-10 04:05:24 +00:00
FROM python:3.10-alpine as base
2021-07-08 01:48:58 +00:00
WORKDIR /app
FROM base as builder
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
2023-04-19 21:17:41 +00:00
POETRY_VERSION=1.2.1
2021-07-08 01:48:58 +00:00
2022-07-28 04:28:08 +00:00
RUN apk add --no-cache build-base libffi-dev musl-dev openssl-dev postgresql-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 04:28:08 +00:00
RUN . /venv/bin/activate \
&& poetry export \
2022-07-28 03:09:27 +00:00
--format requirements.txt \
--without-hashes \
2022-07-28 04:28:08 +00:00
| pip install -r /dev/stdin
2021-07-08 01:48:58 +00:00
COPY . .
2022-07-28 04:28:08 +00:00
RUN . /venv/bin/activate \
&& poetry build \
&& pip install dist/*.whl
2021-07-08 01:48:58 +00:00
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_STATIC=/www
2022-07-28 04:28:08 +00:00
RUN apk add libpq libstdc++ yajl
2021-07-08 01:48:58 +00:00
COPY --from=builder /venv /venv
COPY --from=frontend /www/public /www
2022-07-28 04:28:08 +00:00
COPY docker-entrypoint.sh ./
2021-07-08 01:48:58 +00:00
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["server"]