Update Dockerfile
Browse files- Dockerfile +16 -11
Dockerfile
CHANGED
@@ -1,18 +1,22 @@
|
|
1 |
# Use the PostgresML image
|
2 |
FROM ghcr.io/postgresml/postgresml:2.7.12
|
3 |
|
4 |
-
#
|
5 |
-
|
6 |
|
7 |
-
#
|
8 |
-
|
|
|
9 |
|
10 |
-
#
|
11 |
RUN apt-get update && apt-get install -y sudo
|
12 |
|
13 |
-
#
|
14 |
-
RUN
|
15 |
-
&&
|
|
|
|
|
|
|
16 |
|
17 |
# Set environment variables
|
18 |
ENV HOME=/home/postgresml \
|
@@ -21,11 +25,12 @@ ENV HOME=/home/postgresml \
|
|
21 |
# Expose ports
|
22 |
EXPOSE 5432 8000
|
23 |
|
|
|
|
|
|
|
|
|
24 |
# Switch to non-root user
|
25 |
USER postgresml
|
26 |
|
27 |
-
# Create README.md
|
28 |
-
RUN echo "# PostgresML Space" > README.md
|
29 |
-
|
30 |
# Default command
|
31 |
CMD ["bash", "-c", "psql -d postgresml"]
|
|
|
1 |
# Use the PostgresML image
|
2 |
FROM ghcr.io/postgresml/postgresml:2.7.12
|
3 |
|
4 |
+
# Switch to root to perform initial setup
|
5 |
+
USER root
|
6 |
|
7 |
+
# Create necessary directories with correct permissions
|
8 |
+
RUN mkdir -p /var/run/postgresql /var/lib/postgresql \
|
9 |
+
&& chown -R postgresml:postgresml /var/run/postgresql /var/lib/postgresql
|
10 |
|
11 |
+
# Ensure sudo is available (though it's already installed)
|
12 |
RUN apt-get update && apt-get install -y sudo
|
13 |
|
14 |
+
# Create a user with specific permissions
|
15 |
+
RUN useradd -m -u 1000 postgresml \
|
16 |
+
&& usermod -aG sudo postgresml
|
17 |
+
|
18 |
+
# Set working directory
|
19 |
+
WORKDIR /home/postgresml/app
|
20 |
|
21 |
# Set environment variables
|
22 |
ENV HOME=/home/postgresml \
|
|
|
25 |
# Expose ports
|
26 |
EXPOSE 5432 8000
|
27 |
|
28 |
+
# Create README.md with root permissions
|
29 |
+
RUN echo "# PostgresML Space" > /home/postgresml/README.md \
|
30 |
+
&& chown postgresml:postgresml /home/postgresml/README.md
|
31 |
+
|
32 |
# Switch to non-root user
|
33 |
USER postgresml
|
34 |
|
|
|
|
|
|
|
35 |
# Default command
|
36 |
CMD ["bash", "-c", "psql -d postgresml"]
|