CJGibs commited on
Commit
b901d2c
·
1 Parent(s): 4977c4c

Harden Space startup entrypoint

Browse files
Files changed (5) hide show
  1. .gitignore +4 -0
  2. Dockerfile +3 -2
  3. app/__init__.py +1 -0
  4. app/backend/__init__.py +1 -0
  5. start.sh +21 -0
.gitignore CHANGED
@@ -23,3 +23,7 @@ app/frontend/*.tsbuildinfo
23
  npm-debug.log*
24
  yarn-debug.log*
25
  yarn-error.log*
 
 
 
 
 
23
  npm-debug.log*
24
  yarn-debug.log*
25
  yarn-error.log*
26
+
27
+ # Local env
28
+ .env
29
+ .env.*
Dockerfile CHANGED
@@ -20,14 +20,15 @@ RUN adduser --disabled-password --gecos "" --uid 1000 appuser
20
  COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
 
23
  COPY app/backend ./app/backend
24
  COPY app/data ./app/data
25
  COPY app/public ./app/public
26
  COPY --from=frontend-builder /workspace/app/frontend/dist ./app/frontend/dist
27
 
28
- RUN chown -R 1000:1000 /workspace
29
 
30
  USER 1000
31
  EXPOSE 7860
32
 
33
- CMD ["sh", "-c", "uvicorn app.backend.main:app --host 0.0.0.0 --port ${PORT:-7860}"]
 
20
  COPY requirements.txt .
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ COPY start.sh .
24
  COPY app/backend ./app/backend
25
  COPY app/data ./app/data
26
  COPY app/public ./app/public
27
  COPY --from=frontend-builder /workspace/app/frontend/dist ./app/frontend/dist
28
 
29
+ RUN chmod +x /workspace/start.sh && chown -R 1000:1000 /workspace
30
 
31
  USER 1000
32
  EXPOSE 7860
33
 
34
+ CMD ["/workspace/start.sh"]
app/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # Package marker for Docker/runtime imports.
app/backend/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # Package marker for backend modules.
start.sh ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ PORT_VALUE="${PORT:-7860}"
5
+
6
+ echo "Starting Aether Voice Studio"
7
+ echo "Working directory: $(pwd)"
8
+ echo "Python: $(python --version 2>&1)"
9
+ echo "Port: ${PORT_VALUE}"
10
+
11
+ if [ ! -f /workspace/app/frontend/dist/index.html ]; then
12
+ echo "Frontend build is missing at /workspace/app/frontend/dist/index.html"
13
+ exit 1
14
+ fi
15
+
16
+ if [ ! -f /workspace/app/backend/main.py ]; then
17
+ echo "Backend entrypoint is missing at /workspace/app/backend/main.py"
18
+ exit 1
19
+ fi
20
+
21
+ exec python -m uvicorn main:app --app-dir /workspace/app/backend --host 0.0.0.0 --port "${PORT_VALUE}" --log-level info