Spaces:
Runtime error
Runtime error
Commit ·
79becd2
1
Parent(s): 3b9d25e
shell script to separate file
Browse files- Dockerfile +2 -38
- docker-entrypoint-wrapper.sh +29 -0
Dockerfile
CHANGED
|
@@ -3,57 +3,21 @@ FROM langfuse/langfuse:2
|
|
| 3 |
USER root
|
| 4 |
|
| 5 |
# Install PostgreSQL and necessary dependencies
|
| 6 |
-
RUN echo "Installing PostgreSQL..."
|
| 7 |
RUN apk update && apk add --no-cache \
|
| 8 |
postgresql \
|
| 9 |
postgresql-contrib
|
| 10 |
|
| 11 |
# Set up environment variables
|
| 12 |
-
RUN echo "Setting up environment variables..."
|
| 13 |
ENV DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
|
| 14 |
ENV NEXTAUTH_SECRET=mysecret
|
| 15 |
ENV SALT=mysalt
|
| 16 |
ENV ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
|
| 17 |
ENV NEXTAUTH_URL=http://localhost:3000
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
-
COPY <<EOF /docker-entrypoint-wrapper.sh
|
| 22 |
-
#!/bin/sh
|
| 23 |
-
|
| 24 |
-
# Create necessary directories in the persistent /data volume
|
| 25 |
-
mkdir -p /data/postgresql/data /data/postgresql/run
|
| 26 |
-
chmod 0700 /data/postgresql/data
|
| 27 |
-
chmod 0755 /data/postgresql/run
|
| 28 |
-
|
| 29 |
-
# Initialize PostgreSQL if not already initialized
|
| 30 |
-
if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then
|
| 31 |
-
initdb -D /data/postgresql/data
|
| 32 |
-
fi
|
| 33 |
-
|
| 34 |
-
# Start PostgreSQL with the persistent directories
|
| 35 |
-
pg_ctl -D /data/postgresql/data -o "-c listen_addresses='*' -c unix_socket_directories='/data/postgresql/run'" start
|
| 36 |
-
|
| 37 |
-
# Create database if it doesn't exist
|
| 38 |
-
createdb -h /data/postgresql/run -U postgres postgres || true
|
| 39 |
-
|
| 40 |
-
# Wait for PostgreSQL to be ready
|
| 41 |
-
until pg_isready -h /data/postgresql/run; do
|
| 42 |
-
echo "Waiting for PostgreSQL to be ready..."
|
| 43 |
-
sleep 1
|
| 44 |
-
done
|
| 45 |
-
|
| 46 |
-
# Update DATABASE_URL to use the correct socket directory
|
| 47 |
-
export DATABASE_URL="postgresql://postgres:postgres@%2Fdata%2Fpostgresql%2Frun:5432/postgres"
|
| 48 |
-
|
| 49 |
-
# Run the original entrypoint script
|
| 50 |
-
./web/entrypoint.sh node ./web/server.js --keepAliveTimeout 110000
|
| 51 |
-
EOF
|
| 52 |
-
|
| 53 |
-
RUN echo "Setting permissions for wrapper script..."
|
| 54 |
RUN chmod +x /docker-entrypoint-wrapper.sh
|
| 55 |
|
| 56 |
EXPOSE 3000 5432
|
| 57 |
|
| 58 |
-
RUN echo "Setting entrypoint..."
|
| 59 |
ENTRYPOINT ["dumb-init", "--", "/docker-entrypoint-wrapper.sh"]
|
|
|
|
| 3 |
USER root
|
| 4 |
|
| 5 |
# Install PostgreSQL and necessary dependencies
|
|
|
|
| 6 |
RUN apk update && apk add --no-cache \
|
| 7 |
postgresql \
|
| 8 |
postgresql-contrib
|
| 9 |
|
| 10 |
# Set up environment variables
|
|
|
|
| 11 |
ENV DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
|
| 12 |
ENV NEXTAUTH_SECRET=mysecret
|
| 13 |
ENV SALT=mysalt
|
| 14 |
ENV ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
|
| 15 |
ENV NEXTAUTH_URL=http://localhost:3000
|
| 16 |
|
| 17 |
+
# Copy and set up the wrapper script
|
| 18 |
+
COPY docker-entrypoint-wrapper.sh /docker-entrypoint-wrapper.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
RUN chmod +x /docker-entrypoint-wrapper.sh
|
| 20 |
|
| 21 |
EXPOSE 3000 5432
|
| 22 |
|
|
|
|
| 23 |
ENTRYPOINT ["dumb-init", "--", "/docker-entrypoint-wrapper.sh"]
|
docker-entrypoint-wrapper.sh
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
|
| 3 |
+
# Create necessary directories in the persistent /data volume
|
| 4 |
+
mkdir -p /data/postgresql/data /data/postgresql/run
|
| 5 |
+
chmod 0700 /data/postgresql/data
|
| 6 |
+
chmod 0755 /data/postgresql/run
|
| 7 |
+
|
| 8 |
+
# Initialize PostgreSQL if not already initialized
|
| 9 |
+
if [ ! -f "/data/postgresql/data/PG_VERSION" ]; then
|
| 10 |
+
initdb -D /data/postgresql/data
|
| 11 |
+
fi
|
| 12 |
+
|
| 13 |
+
# Start PostgreSQL with the persistent directories
|
| 14 |
+
pg_ctl -D /data/postgresql/data -o "-c listen_addresses='*' -c unix_socket_directories='/data/postgresql/run'" start
|
| 15 |
+
|
| 16 |
+
# Create database if it doesn't exist
|
| 17 |
+
createdb -h /data/postgresql/run -U postgres postgres || true
|
| 18 |
+
|
| 19 |
+
# Wait for PostgreSQL to be ready
|
| 20 |
+
until pg_isready -h /data/postgresql/run; do
|
| 21 |
+
echo "Waiting for PostgreSQL to be ready..."
|
| 22 |
+
sleep 1
|
| 23 |
+
done
|
| 24 |
+
|
| 25 |
+
# Update DATABASE_URL to use the correct socket directory
|
| 26 |
+
export DATABASE_URL="postgresql://postgres:postgres@%2Fdata%2Fpostgresql%2Frun:5432/postgres"
|
| 27 |
+
|
| 28 |
+
# Run the original entrypoint script
|
| 29 |
+
./web/entrypoint.sh node ./web/server.js --keepAliveTimeout 110000
|