-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOCKERFILE
More file actions
46 lines (35 loc) · 1.56 KB
/
DOCKERFILE
File metadata and controls
46 lines (35 loc) · 1.56 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
# Use an updated and specific version of the Python image
FROM python:3.11-slim-bullseye
# OCI Labels
LABEL org.opencontainers.image.title="AutoDNS" \
org.opencontainers.image.description="Lightweight DNS updater — automatically syncs Cloudflare DNS records via GUID-based identification" \
org.opencontainers.image.authors="baker-scripts" \
org.opencontainers.image.source="https://github.com/baker-scripts/autodns" \
org.opencontainers.image.documentation="https://github.com/baker-scripts/autodns/blob/develop/README.md" \
org.opencontainers.image.licenses="GPL-3.0" \
org.opencontainers.image.vendor="baker-scripts" \
org.opencontainers.image.base.name="python:3.11-slim-bullseye"
# Define work directory
WORKDIR /app
# Set Python to not generate .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Set Python stdout and stderr streams to be unbuffered
ENV PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends gcc libffi-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Update pip and install dependencies via wheel to speed up installation
RUN python -m pip install --upgrade pip setuptools wheel
# Copy only the requirements file to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Specify non-root user to run the app
RUN useradd -m myuser
USER myuser
# Expose the port the app runs on
EXPOSE 4295
# Command to run the application
CMD ["python", "./autodns.py"]