Kaballas commited on
Commit
942acd6
·
verified ·
1 Parent(s): 6b2008e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -20
Dockerfile CHANGED
@@ -1,28 +1,25 @@
1
- # Use an appropriate base image
2
- FROM python:3.9
3
-
4
- # Create a user with specific permissions
5
- RUN useradd -m -u 1000 user
6
-
7
  # Set working directory
8
  WORKDIR /app
9
 
10
- # Copy requirements and install dependencies
11
- COPY --chown=user ./requirements.txt requirements.txt
12
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
13
 
14
- # Copy all project files
15
- COPY --chown=user . /app
16
 
17
- # Switch to non-root user
18
- USER user
19
 
20
- # Set environment variables
21
- ENV HOME=/home/user \
22
- PATH=/home/user/.local/bin:$PATH
23
 
24
- # Expose the default Hugging Face Spaces port
25
- EXPOSE 7860
 
 
 
26
 
27
- # Default command to run the application
28
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM ghcr.io/postgresml/postgresml:2.7.12
2
+ USER root
 
 
 
 
3
  # Set working directory
4
  WORKDIR /app
5
 
6
+ # Expose necessary ports
7
+ EXPOSE 5432 8000
 
8
 
9
+ # Create volume for PostgreSQL data
10
+ VOLUME ["/var/lib/postgresql"]
11
 
12
+ # Install necessary tools
13
+ RUN apt-get update && apt-get install -y sudo
14
 
15
+ # Create a non-root user
16
+ RUN useradd -m -u 1000 postgresml
 
17
 
18
+ # Set permissions
19
+ RUN chown -R postgresml:postgresml /var/lib/postgresql
20
+
21
+ # Set environment variables
22
+ ENV HOME=/home/postgresml
23
 
24
+ # Default command
25
+ CMD ["sudo", "-u", "postgresml", "psql", "-d", "postgresml"]