-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
46 lines (33 loc) · 1.44 KB
/
Dockerfile.backend
File metadata and controls
46 lines (33 loc) · 1.44 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
FROM python:3.12-slim
# APP_VERSION is injected at build time (e.g. --build-arg APP_VERSION=v1.2.3).
# Falls back to "dev" for local builds.
ARG APP_VERSION=dev
LABEL org.opencontainers.image.title="CloudShell Backend" \
org.opencontainers.image.description="Self-hosted web SSH gateway — API server" \
org.opencontainers.image.licenses="GPL-3.0-only" \
org.opencontainers.image.source="https://github.com/iu2frl/CloudShell"
# System deps for asyncssh / cryptography
RUN apt-get update && apt-get install -y --no-install-recommends \
libssl-dev \
curl \
&& rm -rf /var/lib/apt/lists/*
# Run as non-root user
RUN groupadd --gid 1001 appgroup \
&& useradd --uid 1001 --gid appgroup --no-create-home appuser
WORKDIR /app
# Install Python dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Copy backend source
COPY backend/ ./backend/
# Data directory — will be overridden by a volume in production
RUN mkdir -p /data/keys && chmod 700 /data/keys && chown -R appuser:appgroup /data /app
USER appuser
ENV DATA_DIR=/data \
ADMIN_USER=admin \
TOKEN_TTL_HOURS=8 \
APP_VERSION=${APP_VERSION}
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -sf http://localhost:8000/api/health || exit 1
CMD ["python", "-m", "uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000", "--proxy-headers", "--forwarded-allow-ips", "*"]