Dockerfile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # base image
  2. FROM python:3.10-slim-bookworm AS base
  3. LABEL maintainer="takatost@gmail.com"
  4. # install packages
  5. FROM base as packages
  6. RUN apt-get update \
  7. && apt-get install -y --no-install-recommends gcc g++ libc-dev libffi-dev libgmp-dev libmpfr-dev libmpc-dev
  8. COPY requirements.txt /requirements.txt
  9. RUN pip install --prefix=/pkg -r requirements.txt
  10. # production stage
  11. FROM base AS production
  12. ENV FLASK_APP app.py
  13. ENV EDITION SELF_HOSTED
  14. ENV DEPLOY_ENV PRODUCTION
  15. ENV CONSOLE_API_URL http://127.0.0.1:5001
  16. ENV CONSOLE_WEB_URL http://127.0.0.1:3000
  17. ENV SERVICE_API_URL http://127.0.0.1:5001
  18. ENV APP_WEB_URL http://127.0.0.1:3000
  19. EXPOSE 5001
  20. # set timezone
  21. ENV TZ UTC
  22. WORKDIR /app/api
  23. RUN apt-get update \
  24. && apt-get install -y --no-install-recommends curl wget vim nodejs ffmpeg libgmp-dev libmpfr-dev libmpc-dev \
  25. && apt-get autoremove \
  26. && rm -rf /var/lib/apt/lists/*
  27. COPY --from=packages /pkg /usr/local
  28. COPY . /app/api/
  29. COPY docker/entrypoint.sh /entrypoint.sh
  30. RUN chmod +x /entrypoint.sh
  31. ARG COMMIT_SHA
  32. ENV COMMIT_SHA ${COMMIT_SHA}
  33. ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]