Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d003d3c1c7 | |||
| 786dc4c825 | |||
| ef8c4bafe6 | |||
| 58311ba2df | |||
| 410f72caf0 | |||
| f0e2c60620 | |||
| ae0502ce16 | |||
| 3378d5c523 | |||
| b7c4df42e0 | |||
| a8ef158fd7 | |||
| 52e45a663e | |||
| 0c3ffff81c | |||
| 98c60c0d27 | |||
| b20b33bf9b | |||
| ad21d7fb6a |
+8
-2
@@ -39,6 +39,9 @@ ENV NODE_ENV=production
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
openssl \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& groupadd --system --gid 1001 nodejs \
|
||||
&& useradd --system --uid 1001 nextjs \
|
||||
&& mkdir -p /home/nextjs && chown nextjs:nextjs /home/nextjs \
|
||||
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=builder /app/public ./public
|
||||
@@ -53,12 +56,15 @@ COPY --from=builder /app/prisma/schema.prisma /app/schema.prisma
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
|
||||
|
||||
# Create data directory with proper permissions
|
||||
RUN mkdir -p /app/data && chown -R nextjs:nextjs /app
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
ENV PORT=3000
|
||||
ENV HOSTNAME="0.0.0.0"
|
||||
ENV DATABASE_URL="file:/app/data/dev.db"
|
||||
ENV DATABASE_URL="file:./data/dev.db"
|
||||
ENV HOME=/home/nextjs
|
||||
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
CMD ["node", "server.js"]
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -85,13 +85,13 @@ services:
|
||||
- "traefik.http.routers.${NAME_SERVICE}.rule=Host(`recall.vodorod.cl`)"
|
||||
environment:
|
||||
- TZ=America/Santiago
|
||||
- DATABASE_URL=file:/app/data/dev.db
|
||||
- DATABASE_URL=file:./data/dev.db
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
networks:
|
||||
- homelab-net
|
||||
mem_limit: 512m
|
||||
mem_reservation: 256m
|
||||
mem_limit: 32m
|
||||
mem_reservation: 16m
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
homelab-net:
|
||||
|
||||
BIN
Binary file not shown.
+1
-1
@@ -8,5 +8,5 @@ services:
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
environment:
|
||||
- DATABASE_URL=file:/app/data/dev.db
|
||||
- DATABASE_URL=file:./data/dev.db
|
||||
restart: unless-stopped
|
||||
|
||||
+4
-15
@@ -1,25 +1,14 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd /app
|
||||
|
||||
# Initialize database if it doesn't exist or schema changed
|
||||
echo "Checking database..."
|
||||
|
||||
# Ensure data directory exists with proper permissions
|
||||
mkdir -p /app/data
|
||||
chmod 777 /app/data
|
||||
|
||||
# Run db push (creates/updates database schema)
|
||||
# If it fails due to OOM but DB exists, continue anyway
|
||||
./node_modules/prisma/build/index.js db push --skip-generate || {
|
||||
exit_code=$?
|
||||
if [ -f /app/data/dev.db ]; then
|
||||
echo "db push failed (code $exit_code) but database exists, continuing..."
|
||||
else
|
||||
echo "db push failed and database does not exist"
|
||||
exit $exit_code
|
||||
fi
|
||||
}
|
||||
# Use local prisma version from node_modules
|
||||
./node_modules/prisma/build/index.js db push
|
||||
|
||||
echo "Starting application..."
|
||||
exec "$@"
|
||||
exec su nextjs -c "cd /app && node server.js"
|
||||
|
||||
Reference in New Issue
Block a user