-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContainerfile
More file actions
98 lines (74 loc) · 2.84 KB
/
Containerfile
File metadata and controls
98 lines (74 loc) · 2.84 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# use official python slim image as base
ARG PYTHON_VERSION=3.13.0
ARG OPENTOFU_VERSION=1.10.5
FROM python:${PYTHON_VERSION}-slim-bookworm
LABEL maintainer="torerodev <opensource@itential.com>"
LABEL org.opencontainers.image.source="https://github.com/torerodev/torero-container"
LABEL org.opencontainers.image.description="torero container image"
LABEL org.opencontainers.image.licenses="Apache-2.0"
# default locale
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
# default version
ARG TORERO_VERSION=1.5.0
ENV TORERO_VERSION=${TORERO_VERSION}
# OpenTofu default version - can be overridden at runtime with OPENTOFU_VERSION env var
ARG OPENTOFU_VERSION
ENV OPENTOFU_BUILD_VERSION=${OPENTOFU_VERSION:-1.10.5}
# ssh access is disabled by default
ENV ENABLE_SSH_ADMIN=false
# torero eula auto-acceptance is enabled by default
ENV TORERO_APPLICATION_AUTO_ACCEPT_EULA=true
# MCP server is disabled by default
ENV ENABLE_MCP=false
# MCP server default configuration
ENV TORERO_MCP_TRANSPORT_TYPE=sse
ENV TORERO_MCP_TRANSPORT_HOST=0.0.0.0
ENV TORERO_MCP_TRANSPORT_PORT=8080
ENV TORERO_MCP_TRANSPORT_PATH=/sse
ENV TORERO_CLI_TIMEOUT=30
ENV TORERO_LOG_LEVEL=INFO
ENV TORERO_MCP_LOG_FILE=/home/admin/.torero-mcp.log
# ui server is disabled by default
ENV ENABLE_UI=false
ENV UI_PORT=8001
ENV UI_REFRESH_INTERVAL=30
ENV TORERO_UI_LOG_FILE=/home/admin/.torero-ui.log
ENV TORERO_UI_PID_FILE=/tmp/torero-ui.pid
# reduce docker image size
ENV DEBIAN_FRONTEND=noninteractive
# copy scripts to image
COPY configure.sh /configure.sh
COPY entrypoint.sh /entrypoint.sh
# copy torero projects to image
COPY opt/torero-ui /opt/torero-ui
COPY opt/torero-mcp /opt/torero-mcp
# install Python dependencies at build time
RUN pip install --no-cache-dir -e /opt/torero-ui /opt/torero-mcp
# set up Django static files at build time
ENV DJANGO_SETTINGS_MODULE=torero_ui.settings
WORKDIR /opt/torero-ui
RUN CONTAINER_BUILD_MODE=true python torero_ui/manage.py migrate && \
CONTAINER_BUILD_MODE=true python torero_ui/manage.py collectstatic --noinput
WORKDIR /
# runtime packages
RUN apt-get update && apt-get install -y curl unzip supervisor && \
apt-get clean && rm -rf /var/lib/apt/lists/*
# make executable, run configuration script
RUN chmod +x /configure.sh && /configure.sh && \
chmod +x /entrypoint.sh
# expose ssh port (only used if SSH is enabled)
EXPOSE 22
# expose UI port (only used if UI is enabled)
EXPOSE 8001
# expose MCP port (only used if MCP is enabled)
EXPOSE 8080
# create volume for persistent data
VOLUME ["/home/admin/data"]
# healthcheck - is torero functional?
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD torero version || exit 1
# set entrypoint
ENTRYPOINT ["/entrypoint.sh"]
# default command depends on SSH being enabled
CMD ["/bin/bash", "-c", "if [ \"$ENABLE_SSH_ADMIN\" = \"true\" ]; then /usr/sbin/sshd -D; else tail -f /dev/null; fi"]