-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaslerCameraAdapter.Dockerfile
More file actions
65 lines (50 loc) · 1.77 KB
/
BaslerCameraAdapter.Dockerfile
File metadata and controls
65 lines (50 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# syntax=docker/dockerfile:1
# Base Image
FROM python:3.11-slim-bullseye
# Metadata
LABEL author=max-scw
LABEL project=https://github.com/max-scw/BaslerCameraAdapter
LABEL version=2024.12.5
# Environment variables (default values)
ENV LOGFILE=BaslerCameraAdapter
ARG DEBIAN_FRONTEND=noninteractived
# add white-listed websites
RUN printf "deb https://deb.debian.org/debian bullseye main \
deb https://security.debian.org/debian-security bullseye-security main \
deb https://deb.debian.org/debian bullseye-updates main" > /etc/apt/sources.list
# install libraries and command line tools
#RUN apt-get update && apt-get install -y iputils-ping && apt-get clean
# new default user
RUN useradd -ms /bin/bash app
# Set the working directory
WORKDIR /home/app
# Install requirements
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt --no-cache-dir
# Copy app into the container
COPY main.py \
DataModels.py \
BaslerCamera.py \
BaslerCameraThread.py \
utils.py \
utils_fastapi.py \
README.md \
LICENSE \
./
# set to non-root user
USER root
RUN chown -R app:app /home/app
USER app
EXPOSE 5050
# FOR DEBUGGING
#ENTRYPOINT ["tail", "-f", "/dev/null"]
#ENTRYPOINT ["uvicorn", "main:app", "--host=0.0.0.0", "--port=5050"]
ENTRYPOINT ["python", "main.py"]
#HEALTHCHECK --interval=30s --timeout=5s --retries=3 \
# CMD curl -k -f -H "Authorization: Bearer my_secret_token" https://localhost:8000/health || exit 1
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD if [ -n "${ACCESS_TOKEN_HEALTH_CHECK}" ]; then \
curl -s -f -o /dev/null -H "Authorization: Bearer ${ACCESS_TOKEN_HEALTH_CHECK}" http://localhost:5050/health; \
else \
curl -s -f -o /dev/null http://localhost:5050/health; \
fi || exit 1