first commit
This commit is contained in:
@ -1,31 +1,12 @@
|
|||||||
# syntax=docker/dockerfile:1.4
|
|
||||||
# Builder stage: compile dependencies
|
|
||||||
FROM python:3.10-alpine AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install build dependencies
|
|
||||||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirror.kakao.com/g' /etc/apk/repositories \
|
|
||||||
&& apk add --no-cache gcc musl-dev python3-dev mariadb-dev libffi-dev openssl-dev
|
|
||||||
|
|
||||||
# Copy requirements and install
|
|
||||||
COPY requirements.txt .
|
|
||||||
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
|
||||||
|
|
||||||
# Copy application code
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Final stage: minimal runtime image
|
|
||||||
FROM python:3.10-alpine AS final
|
FROM python:3.10-alpine AS final
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy installed packages from builder
|
# Copy only installed dependencies + app
|
||||||
COPY --from=builder /install /usr/local
|
COPY --from=builder /install /usr/local
|
||||||
# Copy app code
|
|
||||||
COPY --from=builder /app /app
|
COPY --from=builder /app /app
|
||||||
|
|
||||||
# Set production environment variables
|
# Production ENV
|
||||||
ENV FLASK_ENV=production
|
ENV FLASK_ENV=production
|
||||||
ENV FLASK_APP=run.py
|
ENV FLASK_APP=run.py
|
||||||
ENV FLASK_RUN_HOST=0.0.0.0
|
ENV FLASK_RUN_HOST=0.0.0.0
|
||||||
@ -33,4 +14,5 @@ ENV FLASK_RUN_PORT=5000
|
|||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
CMD ["flask", "run"]
|
# Use Gunicorn for production
|
||||||
|
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "run:app"]
|
||||||
|
|||||||
@ -3,3 +3,4 @@ Flask-CORS
|
|||||||
Flask-SQLAlchemy
|
Flask-SQLAlchemy
|
||||||
python-dotenv
|
python-dotenv
|
||||||
pymysql
|
pymysql
|
||||||
|
gunicorn
|
||||||
Reference in New Issue
Block a user