Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +13 -30
Dockerfile
CHANGED
@@ -1,38 +1,21 @@
|
|
1 |
# Use pgvector with Postgres 17 as the base image
|
2 |
FROM pgvector/pgvector:pg17
|
3 |
|
4 |
-
#
|
5 |
-
USER root
|
6 |
-
|
7 |
-
# Create the user required by HF Spaces (ID 1000)
|
8 |
-
RUN useradd -m -u 1000 user
|
9 |
-
|
10 |
-
# Set up the data directory with correct permissions
|
11 |
-
RUN mkdir -p /data && \
|
12 |
-
chown -R user:user /data && \
|
13 |
-
chmod 777 /data
|
14 |
-
|
15 |
-
# Create directory for postgres data
|
16 |
-
RUN mkdir -p /var/lib/postgresql/data && \
|
17 |
-
chown -R postgres:postgres /var/lib/postgresql/data && \
|
18 |
-
chmod 700 /var/lib/postgresql/data
|
19 |
-
|
20 |
-
# Set required environment variables
|
21 |
ENV POSTGRES_PASSWORD=postgres
|
22 |
-
ENV
|
23 |
-
ENV PGDATA=/data/postgresql/data
|
24 |
|
25 |
-
# Create
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
#
|
32 |
-
|
33 |
|
34 |
-
# Expose port
|
35 |
-
EXPOSE
|
36 |
|
37 |
-
# Switch
|
38 |
-
USER postgres
|
|
|
1 |
# Use pgvector with Postgres 17 as the base image
|
2 |
FROM pgvector/pgvector:pg17
|
3 |
|
4 |
+
# Set environment variable for PostgreSQL password and data directory
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
ENV POSTGRES_PASSWORD=postgres
|
6 |
+
ENV PGDATA=/data/postgresql
|
|
|
7 |
|
8 |
+
# Create and configure the data directories
|
9 |
+
RUN mkdir -p /data/postgresql && \
|
10 |
+
chown -R postgres:postgres /data && \
|
11 |
+
chmod 777 /data && \
|
12 |
+
chmod 700 /data/postgresql
|
13 |
|
14 |
+
# Set the data directory as a volume
|
15 |
+
VOLUME /data
|
16 |
|
17 |
+
# Expose PostgreSQL port
|
18 |
+
EXPOSE 5432
|
19 |
|
20 |
+
# Switch to postgres user for running the service
|
21 |
+
USER postgres
|