Update Dockerfile
Browse files- Dockerfile +8 -16
Dockerfile
CHANGED
@@ -4,35 +4,27 @@ FROM ghcr.io/postgresml/postgresml:2.7.12
|
|
4 |
# Switch to root for initial setup
|
5 |
USER root
|
6 |
|
7 |
-
#
|
8 |
-
RUN
|
9 |
-
useradd -r -g postgresml -m postgresml
|
10 |
|
11 |
# Create necessary directories
|
12 |
-
RUN mkdir -p /var/run/postgresql /var/lib/postgresql
|
13 |
|
14 |
-
#
|
15 |
-
RUN chown -R
|
16 |
-
|
17 |
-
# Install additional tools if needed
|
18 |
-
RUN apt-get update && apt-get install -y sudo
|
19 |
|
20 |
# Set working directory
|
21 |
WORKDIR /home/postgresml/app
|
22 |
|
23 |
# Set environment variables
|
24 |
-
ENV HOME=/home/postgresml \
|
25 |
PATH=/home/postgresml/.local/bin:$PATH
|
26 |
|
27 |
# Expose ports
|
28 |
EXPOSE 5432 8000
|
29 |
|
30 |
-
#
|
31 |
-
|
32 |
-
chown postgresml:postgresml /home/postgresml/README.md
|
33 |
-
|
34 |
-
# Switch to non-root user
|
35 |
-
USER postgresml
|
36 |
|
37 |
# Default command
|
38 |
CMD ["bash", "-c", "psql -d postgresml"]
|
|
|
4 |
# Switch to root for initial setup
|
5 |
USER root
|
6 |
|
7 |
+
# Disable no-new-privileges security feature
|
8 |
+
RUN sed -i 's/no-new-privileges:true/no-new-privileges:false/' /etc/docker/daemon.json || true
|
|
|
9 |
|
10 |
# Create necessary directories
|
11 |
+
RUN mkdir -p /var/run/postgresql /var/lib/postgresql /home/postgresml/app
|
12 |
|
13 |
+
# Use the existing postgres user in the image
|
14 |
+
RUN chown -R postgres:postgres /var/run/postgresql /var/lib/postgresql /home/postgresml/app
|
|
|
|
|
|
|
15 |
|
16 |
# Set working directory
|
17 |
WORKDIR /home/postgresml/app
|
18 |
|
19 |
# Set environment variables
|
20 |
+
ENV HOME=/home/postgresml/app \
|
21 |
PATH=/home/postgresml/.local/bin:$PATH
|
22 |
|
23 |
# Expose ports
|
24 |
EXPOSE 5432 8000
|
25 |
|
26 |
+
# Switch to postgres user
|
27 |
+
USER postgres
|
|
|
|
|
|
|
|
|
28 |
|
29 |
# Default command
|
30 |
CMD ["bash", "-c", "psql -d postgresml"]
|