2024-01-25 12:44:15 +08:00
|
|
|
# base image
|
|
|
|
FROM python:3.10-slim-bookworm AS base
|
2023-05-15 08:51:32 +08:00
|
|
|
|
|
|
|
LABEL maintainer="takatost@gmail.com"
|
|
|
|
|
2024-01-25 12:44:15 +08:00
|
|
|
# install packages
|
|
|
|
FROM base as packages
|
|
|
|
|
2023-09-10 12:20:58 +08:00
|
|
|
RUN apt-get update \
|
2024-01-26 03:09:24 +08:00
|
|
|
&& apt-get install -y --no-install-recommends gcc g++ libc-dev libffi-dev libgmp-dev libmpfr-dev libmpc-dev
|
2023-09-01 11:13:22 +08:00
|
|
|
|
|
|
|
COPY requirements.txt /requirements.txt
|
|
|
|
|
|
|
|
RUN pip install --prefix=/pkg -r requirements.txt
|
|
|
|
|
2024-01-25 12:44:15 +08:00
|
|
|
# production stage
|
|
|
|
FROM base AS production
|
2024-01-19 20:30:36 +08:00
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
ENV FLASK_APP app.py
|
|
|
|
ENV EDITION SELF_HOSTED
|
|
|
|
ENV DEPLOY_ENV PRODUCTION
|
2023-07-14 11:19:26 +08:00
|
|
|
ENV CONSOLE_API_URL http://127.0.0.1:5001
|
|
|
|
ENV CONSOLE_WEB_URL http://127.0.0.1:3000
|
|
|
|
ENV SERVICE_API_URL http://127.0.0.1:5001
|
|
|
|
ENV APP_WEB_URL http://127.0.0.1:3000
|
2023-05-15 08:51:32 +08:00
|
|
|
|
|
|
|
EXPOSE 5001
|
|
|
|
|
2024-01-19 20:30:36 +08:00
|
|
|
# set timezone
|
|
|
|
ENV TZ UTC
|
|
|
|
|
2023-05-15 08:51:32 +08:00
|
|
|
WORKDIR /app/api
|
|
|
|
|
2023-09-10 12:16:21 +08:00
|
|
|
RUN apt-get update \
|
2024-01-26 03:09:24 +08:00
|
|
|
&& apt-get install -y --no-install-recommends curl wget vim nodejs ffmpeg libgmp-dev libmpfr-dev libmpc-dev \
|
2023-09-01 11:13:22 +08:00
|
|
|
&& apt-get autoremove \
|
|
|
|
&& rm -rf /var/lib/apt/lists/*
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2024-01-25 12:44:15 +08:00
|
|
|
COPY --from=packages /pkg /usr/local
|
2023-05-15 08:51:32 +08:00
|
|
|
COPY . /app/api/
|
|
|
|
|
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh
|
|
|
|
RUN chmod +x /entrypoint.sh
|
|
|
|
|
|
|
|
ARG COMMIT_SHA
|
|
|
|
ENV COMMIT_SHA ${COMMIT_SHA}
|
|
|
|
|
2023-07-18 16:22:34 +08:00
|
|
|
ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|