Update Dockerfile
Browse files- Dockerfile +17 -20
Dockerfile
CHANGED
@@ -1,28 +1,25 @@
|
|
1 |
-
|
2 |
-
|
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 |
-
#
|
11 |
-
|
12 |
-
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
13 |
|
14 |
-
#
|
15 |
-
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
|
20 |
-
#
|
21 |
-
|
22 |
-
PATH=/home/user/.local/bin:$PATH
|
23 |
|
24 |
-
#
|
25 |
-
|
|
|
|
|
|
|
26 |
|
27 |
-
# Default command
|
28 |
-
CMD ["
|
|
|
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"]
|