|
|
|
|
|
FROM node:18-alpine AS frontend-build |
|
|
WORKDIR /build |
|
|
COPY frontend/package*.json ./frontend/ |
|
|
COPY frontend/ ./ |
|
|
RUN npm ci |
|
|
RUN npm run build |
|
|
|
|
|
|
|
|
FROM python:3.11-slim AS backend-build |
|
|
RUN useradd -m -u 1000 user |
|
|
ENV HOME=/home/user \ |
|
|
PATH=/home/user/.local/bin:$PATH |
|
|
WORKDIR /home/user/app |
|
|
RUN apt-get update && apt-get install -y gcc && rm -rf /var/lib/apt/lists/* |
|
|
COPY backend/requirements.txt /tmp/requirements.txt |
|
|
RUN pip install --no-cache-dir -r /tmp/requirements.txt |
|
|
COPY backend/ /home/user/app |
|
|
COPY --from=frontend-build /build/dist /home/user/app/frontend_dist |
|
|
RUN mkdir -p /data && chmod 700 /data |
|
|
USER user |
|
|
RUN pip install --no-cache-dir --upgrade pip |
|
|
|
|
|
|
|
|
FROM python:3.11-slim |
|
|
RUN apt-get update && apt-get install -y nginx supervisor gcc && rm -rf /var/lib/apt/lists/* |
|
|
RUN useradd -m -u 1000 user |
|
|
ENV HOME=/home/user \ |
|
|
PATH=/home/user/.local/bin:$PATH |
|
|
WORKDIR /home/user/app |
|
|
COPY --from=backend-build /home/user/app /home/user/app |
|
|
COPY --from=backend-build /data /data |
|
|
COPY nginx.conf /etc/nginx/nginx.conf |
|
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf |
|
|
RUN mkdir -p /data && chmod 700 /data |
|
|
USER user |
|
|
EXPOSE 7860 |
|
|
|
|
|
CMD ["supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"] |
|
|
|