forked from rcarmo/webterm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (32 loc) · 1.19 KB
/
Dockerfile
File metadata and controls
40 lines (32 loc) · 1.19 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
# Minimal image for serving a web terminal with Docker watch mode
#
# Build: docker build -t webterm .
# Run: docker run -v /var/run/docker.sock:/var/run/docker.sock -p 8080:8080 webterm --docker-watch
#
FROM python:3.12-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
make \
&& rm -rf /var/lib/apt/lists/*
# Copy only what's needed for installation
WORKDIR /build
COPY pyproject.toml poetry.lock* ./
COPY README.md ./
COPY src/ ./src/
# Install the package
RUN pip install --no-cache-dir .
# Final minimal image
FROM python:3.12-slim
# Install only runtime dependencies (docker CLI for exec commands)
RUN apt-get update && apt-get install -y --no-install-recommends \
docker.io \
&& rm -rf /var/lib/apt/lists/*
# Copy installed packages from builder
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY --from=builder /usr/local/bin/webterm /usr/local/bin/webterm
# Create non-root user (optional, but may need root for Docker socket access)
# RUN useradd -m webterm
# USER webterm
EXPOSE 8080
ENTRYPOINT ["webterm"]
CMD ["--host", "0.0.0.0", "--port", "8080", "--docker-watch"]