|
|
|
FROM node:20.11-alpine3.19 AS base |
|
|
|
|
|
ENV NODE_OPTIONS="--max_old_space_size=2048" \ |
|
NEXT_TELEMETRY_DISABLED=1 \ |
|
NODE_ENV=production \ |
|
PYTHONDONTWRITEBYTECODE=1 \ |
|
POETRY_NO_INTERACTION=1 \ |
|
POETRY_VIRTUALENVS_CREATE=false \ |
|
POETRY_CACHE_DIR=/cache/poetry |
|
|
|
|
|
FROM base AS web-builder |
|
|
|
WORKDIR /app/web |
|
|
|
|
|
COPY web/package.json web/yarn.lock ./ |
|
|
|
|
|
RUN npm install -g code-inspector-plugin autoprefixer postcss tailwindcss |
|
|
|
|
|
RUN yarn install --frozen-lockfile --network-timeout 300000 && \ |
|
yarn add --dev @types/node @types/react code-inspector-plugin autoprefixer postcss tailwindcss |
|
|
|
|
|
COPY web/ . |
|
|
|
|
|
RUN if [ ! -f next.config.js ]; then \ |
|
echo "module.exports = { reactStrictMode: true };" > next.config.js; \ |
|
fi |
|
|
|
|
|
RUN NODE_PATH=/usr/local/lib/node_modules yarn build |
|
|
|
|
|
FROM python:3.10-slim-bookworm AS python-builder |
|
|
|
|
|
RUN apt-get update && \ |
|
apt-get install -y --no-install-recommends \ |
|
build-essential \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
WORKDIR /app/api |
|
|
|
|
|
RUN pip install --no-cache-dir poetry |
|
|
|
|
|
COPY api/pyproject.toml api/poetry.lock ./ |
|
RUN poetry config virtualenvs.create false && \ |
|
poetry install --no-dev --no-interaction --no-ansi |
|
|
|
|
|
FROM python:3.10-slim-bookworm |
|
|
|
|
|
RUN apt-get update && \ |
|
apt-get install -y --no-install-recommends \ |
|
nodejs \ |
|
npm \ |
|
&& rm -rf /var/lib/apt/lists/* |
|
|
|
WORKDIR /app |
|
|
|
|
|
COPY --from=python-builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages |
|
COPY api/ /app/api/ |
|
|
|
|
|
COPY --from=web-builder /app/web/.next /app/web/.next |
|
COPY --from=web-builder /app/web/public /app/web/public |
|
COPY --from=web-builder /app/web/node_modules /app/web/node_modules |
|
COPY --from=web-builder /app/web/package.json /app/web/package.json |
|
|
|
|
|
ENV FLASK_APP=app.py \ |
|
EDITION=SELF_HOSTED \ |
|
DEPLOY_ENV=PRODUCTION \ |
|
CONSOLE_API_URL=http://127.0.0.1:5001 \ |
|
CONSOLE_WEB_URL=http://127.0.0.1:3000 \ |
|
SERVICE_API_URL=http://127.0.0.1:5001 \ |
|
APP_WEB_URL=http://127.0.0.1:3000 \ |
|
NODE_ENV=production |
|
|
|
|
|
EXPOSE 3000 5001 |
|
|
|
|
|
COPY docker/entrypoint.sh /entrypoint.sh |
|
RUN chmod +x /entrypoint.sh |
|
|
|
CMD ["/entrypoint.sh"] |