Skip to content

Commit 1efea0e

Browse files
committed
Docker Entrypoint for Secret Mounts
1 parent 326e168 commit 1efea0e

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

Dockerfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ EXPOSE 8080
3838
ENV FLET_SERVER_IP=0.0.0.0
3939
ENV FLET_SERVER_PORT=8080
4040
ENV FLET_FORCE_WEB_SOCKET=true
41-
ENV FLET_SECRET=switchcraft_secure_session
41+
# FLET_SECRET should be passed at runtime for security
42+
# ENV FLET_SECRET=change_me_at_runtime
4243
ENV FLET_REMOTE_ADDR_HEADER=X-Forwarded-For
4344
ENV FLET_WEB_URL=http://localhost:8080
4445
ENV FLET_ENTRY_URL=http://localhost:8080
@@ -49,6 +50,13 @@ ENV SC_DISABLE_WINGET_INSTALL=1
4950
# Create symlink for assets so Flet can find them at /app/assets
5051
RUN ln -s /app/src/switchcraft/assets /app/assets
5152

53+
# Copy entrypoint script
54+
COPY docker-entrypoint.sh /docker-entrypoint.sh
55+
RUN chmod +x /docker-entrypoint.sh
56+
57+
# Set entrypoint
58+
ENTRYPOINT ["/docker-entrypoint.sh"]
59+
5260
# Command to run the application using the Auth Proxy Server
5361
# Added --proxy-headers and --forwarded-allow-ips='*' to fix UUID hostname issues in Docker/K8s
5462
CMD ["uvicorn", "switchcraft.server.app:app", "--host", "0.0.0.0", "--port", "8080", "--proxy-headers", "--forwarded-allow-ips='*'"]

docker-entrypoint.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Definition of the secret file path
5+
# Defaults to /run/secrets/flet_secret if not set via env
6+
: ${FLET_SECRET_FILE:=/run/secrets/flet_secret}
7+
8+
# Check if the secret file exists
9+
if [ -f "$FLET_SECRET_FILE" ]; then
10+
echo "Files based secret found at $FLET_SECRET_FILE. Exporting FLET_SECRET..."
11+
export FLET_SECRET=$(cat "$FLET_SECRET_FILE")
12+
fi
13+
14+
# Execute the CMD passed to the docker container
15+
exec "$@"

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "switchcraft"
7-
version = "2026.1.5b4"
7+
version = "2026.1.5b4.dev0+4d8700a"
88
description = "A comprehensive enterprise IT platform for software packaging, analysis, and Intune management."
99
readme = "README.md"
1010
authors = [{ name = "FaserF" }]
@@ -21,8 +21,6 @@ dependencies = [
2121
"click",
2222
"rich",
2323
"PyYAML",
24-
"openai",
25-
"google-generativeai",
2624
"defusedxml",
2725
"PyJWT",
2826
"anyio>=4.12.1",
@@ -66,6 +64,11 @@ web-server = [
6664
"webauthn"
6765
]
6866

67+
ai = [
68+
"openai",
69+
"google-generativeai"
70+
]
71+
6972
[project.scripts]
7073
switchcraft = "switchcraft.main:main"
7174

src/switchcraft/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2026.1.5b4"
1+
__version__ = "2026.1.5b4.dev0+4d8700a"
22

33
import sys
44
IS_WEB = sys.platform == "emscripten"

0 commit comments

Comments
 (0)