From 4ac37dd3bd1b41ed6f5819d9abf9edef020bbc11 Mon Sep 17 00:00:00 2001 From: Son Nguyen Hoang Date: Wed, 27 Mar 2024 19:18:37 -0400 Subject: [PATCH] Update: Enhanced UI layout & design (#111) --- MovieVerse-APIs/Dockerfile | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 MovieVerse-APIs/Dockerfile diff --git a/MovieVerse-APIs/Dockerfile b/MovieVerse-APIs/Dockerfile new file mode 100644 index 00000000..42dab7d1 --- /dev/null +++ b/MovieVerse-APIs/Dockerfile @@ -0,0 +1,41 @@ +# ---- Base Node ---- +FROM node:14 AS base +WORKDIR /app +COPY package*.json ./ + +# ---- Dependencies ---- +FROM base AS dependencies +RUN npm set progress=false && npm config set depth 0 +RUN npm install --only=production +COPY . . +RUN npm run build + +# ---- Copy Frontend Artifacts ---- +# Separate stage for extracting frontend build artifacts +FROM dependencies AS frontend-artifacts +RUN mkdir -p /app/public +RUN cp -R build/ /app/public/ + +# ---- Python Base ---- +FROM python:3.8 AS python-base +WORKDIR /app +COPY --from=frontend-artifacts /app/public /app/public +COPY backend/requirements.txt /app/ +RUN pip install --no-cache-dir -r requirements.txt + +# ---- Copy Backend Code ---- +FROM python-base AS backend-code +COPY backend /app + +# ---- Release with Gunicorn ---- +FROM backend-code AS release +# Set environment variables +ENV PYTHONUNBUFFERED=1 \ + PYTHONDONTWRITEBYTECODE=1 \ + PATH="/app:${PATH}" + +# Expose port for the backend +EXPOSE 8080 + +# Start Gunicorn +CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--workers", "3", "--threads", "3", "TheMovieVerseApp.wsgi:application"]