first draft for Dockerfile

This commit is contained in:
simplypower-bbj
2023-06-25 20:33:57 +02:00
parent 4bf9b7af0a
commit 28b4275e3d
+47
View File
@@ -0,0 +1,47 @@
###########
# Builder #
###########
# pull official base image
FROM python:alpine as builder
# update system
RUN apk update && \
apk add git && \
apk add rsync && \
apk add docker
# set work directory
WORKDIR /usr/src/app
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install dependencies
RUN pip install --upgrade pip
COPY requirements.txt .
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
#########
# Final #
#########
# pull official base image
FROM python:alpine
# create app home
ENV APP_HOME = /home/app
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
# install packages from builder
COPY --from=builder /usr/src/app/wheels /wheels
COPY --from=builder /usr/src/app/requirements.txt requirements.txt
RUN pip install --no-cache /wheels/*
# copy in files
COPY ./code .
# start execution
ENTRYPOINT [ "python", "main.py" ]