AstraOS commited on
Commit
04fb59a
·
verified ·
1 Parent(s): de41068

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -9
Dockerfile CHANGED
@@ -1,6 +1,7 @@
1
- FROM python:3.11-slim-bullseye AS base
 
2
 
3
- # Create a user for security
4
  RUN useradd -m -u 1000 user
5
  USER user
6
  ENV PATH="/home/user/.local/bin:$PATH"
@@ -18,13 +19,16 @@ COPY --chown=user . /app
18
  # Install Node.js separately
19
  FROM node:20-slim AS nodebuilder
20
  WORKDIR /app
21
- COPY --from=base /app /app
22
-
23
- # Install Node.js dependencies
24
  RUN npm install --production
25
 
26
- # Expose port 3000 for the website
27
- EXPOSE 3000
 
 
 
 
 
28
 
29
- # Start the Node.js server and optionally run Python bots
30
- CMD ["/bin/bash", "-c", "node server.js"]
 
1
+ FROM python:3.11-slim-bullseye AS builder
2
+ LABEL maintainer="YourName"
3
 
4
+ # Create and switch to a non-root user
5
  RUN useradd -m -u 1000 user
6
  USER user
7
  ENV PATH="/home/user/.local/bin:$PATH"
 
19
  # Install Node.js separately
20
  FROM node:20-slim AS nodebuilder
21
  WORKDIR /app
22
+ COPY . /app
 
 
23
  RUN npm install --production
24
 
25
+ # Final container merging Python and Node.js
26
+ FROM python:3.11-slim-bullseye
27
+ COPY --from=nodebuilder /app /app
28
+ WORKDIR /app
29
+
30
+ # Expose necessary ports
31
+ EXPOSE 3000 7860
32
 
33
+ # Run both services
34
+ CMD ["/bin/bash", "-c", "node server.js & uvicorn app:app --host 0.0.0.0 --port 3000"]