|
|
|
FROM node:14 as frontend |
|
|
|
WORKDIR /frontend |
|
|
|
COPY frontend/package*.json ./ |
|
RUN npm install |
|
|
|
COPY frontend /frontend |
|
RUN npm run build |
|
|
|
|
|
FROM python:3.8-slim |
|
|
|
WORKDIR /app |
|
|
|
|
|
ENV NPM_CONFIG_PREFIX=/app/.npm-global |
|
ENV XDG_CACHE_HOME=/app/.cache |
|
|
|
|
|
RUN mkdir -p /app/.npm-global && chown -R 1000:0 /app/.npm-global |
|
RUN mkdir -p /app/.cache && chown -R 1000:0 /app/.cache |
|
|
|
|
|
RUN apt-get update && apt-get install -y nodejs npm && apt-get clean |
|
|
|
|
|
COPY backend/app/requirements.txt . |
|
RUN pip install --no-cache-dir -r requirements.txt |
|
|
|
|
|
COPY --from=frontend /frontend/build /app/frontend/build |
|
|
|
|
|
COPY backend/app /app |
|
|
|
|
|
EXPOSE 8000 |
|
EXPOSE 3000 |
|
|
|
|
|
CMD uvicorn main:app --host 0.0.0.0 --port 8000 & cd frontend/build && npx serve -s -l 3000 |
|
|