Commit
·
39cc6c1
1
Parent(s):
352ca6d
single Dockerfile, working locally
Browse files- Dockerfile +46 -0
Dockerfile
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM langfuse/langfuse:2
|
| 2 |
+
|
| 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 |
+
# Create postgres user and data directory
|
| 11 |
+
RUN mkdir -p /var/lib/postgresql/data && \
|
| 12 |
+
chown -R postgres:postgres /var/lib/postgresql/data && \
|
| 13 |
+
chmod 0700 /var/lib/postgresql/data
|
| 14 |
+
|
| 15 |
+
# Set up environment variables
|
| 16 |
+
ENV DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
|
| 17 |
+
ENV NEXTAUTH_SECRET=mysecret
|
| 18 |
+
ENV SALT=mysalt
|
| 19 |
+
ENV ENCRYPTION_KEY=0000000000000000000000000000000000000000000000000000000000000000
|
| 20 |
+
ENV NEXTAUTH_URL=http://localhost:3000
|
| 21 |
+
|
| 22 |
+
# Create a wrapper script that will start Postgres before running the original entrypoint
|
| 23 |
+
COPY <<EOF /docker-entrypoint-wrapper.sh
|
| 24 |
+
#!/bin/sh
|
| 25 |
+
# Initialize PostgreSQL
|
| 26 |
+
mkdir -p /run/postgresql
|
| 27 |
+
chown postgres:postgres /run/postgresql
|
| 28 |
+
su postgres -c "initdb -D /var/lib/postgresql/data"
|
| 29 |
+
su postgres -c "pg_ctl -D /var/lib/postgresql/data -l /var/log/postgresql/postgresql.log -o '-c listen_addresses=*' start"
|
| 30 |
+
su postgres -c "createdb -U postgres postgres" || true
|
| 31 |
+
|
| 32 |
+
# Wait for PostgreSQL to be ready
|
| 33 |
+
while ! su postgres -c "pg_isready"; do
|
| 34 |
+
echo "Waiting for PostgreSQL to be ready..."
|
| 35 |
+
sleep 1
|
| 36 |
+
done
|
| 37 |
+
|
| 38 |
+
# Run the original entrypoint script
|
| 39 |
+
./web/entrypoint.sh node ./web/server.js --keepAliveTimeout 110000
|
| 40 |
+
EOF
|
| 41 |
+
|
| 42 |
+
RUN chmod +x /docker-entrypoint-wrapper.sh
|
| 43 |
+
|
| 44 |
+
EXPOSE 3000 5432
|
| 45 |
+
|
| 46 |
+
ENTRYPOINT ["dumb-init", "--", "/docker-entrypoint-wrapper.sh"]
|