Files
bandwidth_probing/Dockerfile
T
brb 448f757bd1
pipeline / Test (push) Successful in 33s
Docker / Test (push) Successful in 30s
Docker / Publish (push) Successful in 27s
added copying of JDK 17 into image
2023-07-24 16:24:01 +02:00

54 lines
1.1 KiB
Docker

###########
# BUILDER #
###########
# pull official base image
FROM python:3.10-bookworm as BUILDER
# install JDK 17
ENV JAVA_HOME=/opt/java/openjdk
COPY --from=eclipse-temurin:17-jre $JAVA_HOME $JAVA_HOME
ENV PATH="${JAVA_HOME}/bin:${PATH}"
# install Ookla's speedtest
RUN apt update && \
apt install -y speedtest-cli
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# install dependencies
WORKDIR /usr/src/app
COPY requirements.txt .
RUN pip install --upgrade pip && \
pip wheel --no-cache-dir --no-deps --wheel-dir /usr/src/app/wheels -r requirements.txt
#########
# FINAL #
#########
FROM python:3.10-bookworm
# create home direcroty and app user
RUN mkdir -p /home/app && \
addgroup --system app && \
adduser --system --group app
# 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
WORKDIR /home/app
COPY ./code .
# change ownership to app user
RUN chown -R app:app /home/app
# change to the app user
USER app
# start execution
ENTRYPOINT [ "python", "main.py" ]