MagicPodcast/Dockerfile

25 lines
898 B
Docker
Raw Normal View History

FROM alpine:3.9 AS build
WORKDIR /opt/app/MagicPodcast
# Install Python and external dependencies, including headers and GCC
RUN apk add --no-cache python3 python3-dev py3-pip libffi libffi-dev musl-dev gcc
# Install Pipenv
RUN pip3 install pipenv
# Create a virtual environment and activate it
RUN python3 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH" VIRTUAL_ENV="/opt/venv"
# Install dependencies into the virtual environment with Pipenv
COPY Pipfile Pipfile.lock /opt/app/MagicPodcast
RUN pipenv install --deploy
FROM alpine:3.9
WORKDIR /opt/app/MagicPodcast
# Install Python and external runtime dependencies only
RUN apk add --no-cache python3 libffi
# Copy the virtual environment from the previous image
COPY --from=build /opt/venv /opt/venv
# Activate the virtual environment
ENV PATH="/opt/venv/bin:$PATH" VIRTUAL_ENV="/opt/venv"
# Copy your application
COPY . /opt/app/MagicPodcast