Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (34 loc) · 1.88 KB
/
Copy pathDockerfile
File metadata and controls
44 lines (34 loc) · 1.88 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
# ── BEACONlist pipeline ──────────────────────────────────────────────────────
# Runs the three-step pipeline and writes output to /data/latest/BEACONlist.json
# Mount a host directory to /data to persist results between runs.
#
# Build: docker build -t beaconlist .
# Run: docker run --rm -v ./data:/data beaconlist
# ─────────────────────────────────────────────────────────────────────────────
FROM python:3.11-slim
# System deps (curl useful for health-checks; ca-certificates for HTTPS)
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python dependencies first (layer-cached as long as requirements.txt doesn't change)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy source
COPY src/ ./src/
# The scripts resolve all paths relative to /app, so the working directory
# must be /app at runtime. Data written to /app/data/... is bind-mounted
# via the /data volume (see entrypoint.sh).
COPY entrypoint.sh .
RUN chmod +x entrypoint.sh
# /data is the mount point for persistent output (scraped, refined, latest)
VOLUME ["/data"]
# Run as non-root – good practice for any container making outbound network calls
# (running this instead of the one line below might create hassle with permissions)
RUN useradd --create-home --shell /bin/sh beacon \
&& mkdir -p /app/data/scraped /app/data/refined /app/latest /data \
&& chown -R beacon:beacon /app /data
USER beacon
# # less hassle with permissions:
# RUN mkdir -p /app/data/scraped /app/data/refined /app/latest /data
ENTRYPOINT ["./entrypoint.sh"]