-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (55 loc) · 1.88 KB
/
Copy pathDockerfile
File metadata and controls
74 lines (55 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# syntax=docker/dockerfile:1
# ============================================
# UI-CLI Docker Image
# Gorilla Powered! 🦍
# ============================================
FROM python:3.11-slim as builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Copy dependency files
COPY pyproject.toml .
COPY src/ src/
COPY VERSION .
COPY README.md .
# Install package
RUN pip install --no-cache-dir --user .
# ============================================
# Production image
# ============================================
FROM python:3.11-slim
LABEL org.opencontainers.image.title="UI-CLI"
LABEL org.opencontainers.image.description="Manage your UniFi infrastructure from the command line"
LABEL org.opencontainers.image.source="https://github.com/vedanta/ui-cli"
LABEL org.opencontainers.image.licenses="MIT"
WORKDIR /app
# Create non-root user
RUN useradd --create-home --shell /bin/bash uicli
# Copy installed packages from builder
COPY --from=builder /root/.local /home/uicli/.local
# Copy application
COPY --chown=uicli:uicli src/ src/
COPY --chown=uicli:uicli VERSION .
# Copy entrypoint
COPY --chown=uicli:uicli docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Create config directory for session persistence
RUN mkdir -p /home/uicli/.config/ui-cli && \
chown -R uicli:uicli /home/uicli/.config
# Switch to non-root user
USER uicli
# Add local bin to PATH
ENV PATH="/home/uicli/.local/bin:${PATH}"
# Environment variables (override at runtime)
ENV UNIFI_API_KEY=""
ENV UNIFI_CONTROLLER_URL=""
ENV UNIFI_CONTROLLER_USERNAME=""
ENV UNIFI_CONTROLLER_PASSWORD=""
ENV UNIFI_CONTROLLER_SITE="default"
ENV UNIFI_CONTROLLER_VERIFY_SSL="false"
# Volume for session persistence
VOLUME ["/home/uicli/.config/ui-cli"]
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["--help"]