Spaces:
Build error
Build error
Update Dockerfile for correct directory structure
Browse files- Dockerfile +42 -33
- docker/entrypoint.sh +18 -0
Dockerfile
CHANGED
@@ -1,37 +1,46 @@
|
|
1 |
-
# Use
|
2 |
-
FROM
|
3 |
|
4 |
-
# Install
|
5 |
-
RUN
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
# Set
|
8 |
WORKDIR /app
|
9 |
|
10 |
-
# Copy
|
11 |
-
COPY
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
#
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
ENV
|
30 |
-
ENV
|
31 |
-
ENV
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use Python as base image since it's the main application runtime
|
2 |
+
FROM python:3.10-slim-bookworm
|
3 |
|
4 |
+
# Install required system dependencies
|
5 |
+
RUN apt-get update && apt-get install -y \
|
6 |
+
curl \
|
7 |
+
nodejs \
|
8 |
+
npm \
|
9 |
+
&& rm -rf /var/lib/apt/lists/*
|
10 |
|
11 |
+
# Set working directory
|
12 |
WORKDIR /app
|
13 |
|
14 |
+
# Copy application files
|
15 |
+
COPY api/ /app/api/
|
16 |
+
COPY web/ /app/web/
|
17 |
+
|
18 |
+
# Install Python dependencies for API
|
19 |
+
WORKDIR /app/api
|
20 |
+
RUN pip install poetry && \
|
21 |
+
poetry config virtualenvs.create false && \
|
22 |
+
poetry install --no-dev
|
23 |
+
|
24 |
+
# Install Node.js dependencies and build web frontend
|
25 |
+
WORKDIR /app/web
|
26 |
+
RUN npm install && \
|
27 |
+
npm run build
|
28 |
+
|
29 |
+
# Set environment variables
|
30 |
+
ENV FLASK_APP=app.py
|
31 |
+
ENV EDITION=SELF_HOSTED
|
32 |
+
ENV DEPLOY_ENV=PRODUCTION
|
33 |
+
ENV CONSOLE_API_URL=http://127.0.0.1:5001
|
34 |
+
ENV CONSOLE_WEB_URL=http://127.0.0.1:3000
|
35 |
+
ENV SERVICE_API_URL=http://127.0.0.1:5001
|
36 |
+
ENV APP_WEB_URL=http://127.0.0.1:3000
|
37 |
+
|
38 |
+
# Expose ports
|
39 |
+
EXPOSE 3000 5001
|
40 |
+
|
41 |
+
# Copy and setup entrypoint script
|
42 |
+
COPY docker/entrypoint.sh /entrypoint.sh
|
43 |
+
RUN chmod +x /entrypoint.sh
|
44 |
+
|
45 |
+
# Start both API and web services
|
46 |
+
CMD ["/entrypoint.sh"]
|
docker/entrypoint.sh
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
set -e
|
3 |
+
|
4 |
+
# Start API server in background
|
5 |
+
cd /app/api
|
6 |
+
gunicorn --bind 0.0.0.0:5001 \
|
7 |
+
--workers 1 \
|
8 |
+
--worker-class gevent \
|
9 |
+
--timeout 200 \
|
10 |
+
--preload \
|
11 |
+
app:app &
|
12 |
+
|
13 |
+
# Start web server
|
14 |
+
cd /app/web
|
15 |
+
npm start
|
16 |
+
|
17 |
+
# Keep container running
|
18 |
+
wait
|