|
FROM langfuse/langfuse:2 |
|
|
|
USER root |
|
|
|
# Install PostgreSQL and necessary dependencies |
|
RUN apk update && apk add |
|
postgresql \ |
|
postgresql-contrib |
|
|
|
# Create postgres user and data directory with proper permissions |
|
RUN mkdir -p /var/lib/postgresql/data /run/postgresql && \ |
|
chown -R postgres:postgres /var/lib/postgresql/data /run/postgresql && \ |
|
chmod 0700 /var/lib/postgresql/data && \ |
|
chmod 0755 /run/postgresql |
|
|
|
# Set up environment variables |
|
ENV DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres |
|
ENV NEXTAUTH_SECRET=mysecret |
|
ENV SALT=mysalt |
|
ENV ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000 |
|
ENV NEXTAUTH_URL=http://localhost:3000 |
|
|
|
# Simplified wrapper script running everything as root |
|
COPY <<EOF /docker-entrypoint-wrapper.sh |
|
#!/bin/sh |
|
|
|
# Initialize PostgreSQL |
|
initdb -D /var/lib/postgresql/data |
|
pg_ctl -D /var/lib/postgresql/data -l /var/log/postgresql/postgresql.log -o '-c listen_addresses=*' start |
|
createdb -U postgres postgres || true |
|
|
|
# Wait for PostgreSQL to be ready |
|
until pg_isready; do |
|
echo "Waiting for PostgreSQL to be ready..." |
|
sleep 1 |
|
done |
|
|
|
# Run the original entrypoint script |
|
./web/entrypoint.sh node ./web/server.js |
|
EOF |
|
|
|
RUN chmod +x /docker-entrypoint-wrapper.sh |
|
|
|
EXPOSE 3000 5432 |
|
|
|
ENTRYPOINT ["dumb-init", "--", "/docker-entrypoint-wrapper.sh"] |