2023-01-24 19:58:55 +00:00
|
|
|
# --build-arg BASE_IMAGE=python:3.11-slim-buster
|
2023-08-12 13:52:19 +00:00
|
|
|
ARG BASE_IMAGE=python:3.12-slim-bookworm
|
2023-01-24 19:58:55 +00:00
|
|
|
FROM $BASE_IMAGE
|
2022-11-19 08:18:24 +00:00
|
|
|
|
2022-12-28 21:28:54 +00:00
|
|
|
# https://docs.docker.com/engine/reference/builder/
|
|
|
|
|
|
|
|
# For debugging
|
|
|
|
# docker build . -t extract_otp_secrets --pull --build-arg RUN_TESTS=false
|
|
|
|
# docker run --rm -v "$(pwd)":/files:ro extract_otp_secrets
|
|
|
|
# docker run --entrypoint /extract/run_pytest.sh --rm -v "$(pwd)":/files:ro extract_otp_secrets
|
|
|
|
# docker run --entrypoint /bin/bash -it --rm -v "$(pwd)":/files:ro --device="/dev/video0:/dev/video0" --env="DISPLAY" -v /tmp/.X11-unix:/tmp/.X11-unix:ro extract_otp_secrets
|
|
|
|
|
2022-11-19 08:18:24 +00:00
|
|
|
WORKDIR /extract
|
|
|
|
|
2023-01-24 19:58:55 +00:00
|
|
|
COPY requirements*.txt src/ run_pytest.sh pytest.ini tests/ example_*.txt example_*.png example_*.csv example*.json docker/.alias ./
|
2022-11-19 08:18:24 +00:00
|
|
|
|
2022-12-28 21:28:54 +00:00
|
|
|
ARG RUN_TESTS=true
|
2022-12-24 00:59:35 +00:00
|
|
|
|
2023-02-18 10:32:34 +00:00
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
2022-12-28 21:28:54 +00:00
|
|
|
libgl1 \
|
|
|
|
libglib2.0-0 \
|
|
|
|
libsm6 \
|
|
|
|
libzbar0 \
|
2023-01-29 15:18:21 +00:00
|
|
|
python3-tk \
|
2022-12-28 21:28:54 +00:00
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
2023-04-15 07:29:22 +00:00
|
|
|
&& pip install --no-cache-dir -U pip -r requirements.txt \
|
2023-01-24 19:58:55 +00:00
|
|
|
&& if [ "$RUN_TESTS" = "true" ]; then /extract/run_pytest.sh; else echo "Not running tests..."; fi \
|
|
|
|
&& echo 'test -s /extract/.alias && . /extract/.alias || true' >> ~/.bashrc
|
2022-11-19 08:18:24 +00:00
|
|
|
|
|
|
|
WORKDIR /files
|
|
|
|
|
2023-01-24 19:58:55 +00:00
|
|
|
ENTRYPOINT ["python", "/extract/extract_otp_secrets.py"]
|
2022-12-24 00:59:35 +00:00
|
|
|
|
2022-12-28 21:28:54 +00:00
|
|
|
LABEL org.opencontainers.image.source https://github.com/scito/extract_otp_secrets
|
|
|
|
LABEL org.opencontainers.image.license GPL-3.0+
|
2023-01-24 19:58:55 +00:00
|
|
|
LABEL maintainer="Scito https://scito.ch, https://github.com/scito"
|