fix: docker permission again two.
Some checks failed
Build and Push Docker Image / buildx (push) Has been cancelled

This commit is contained in:
2025-11-11 15:28:38 +08:00
parent 3c271a2a72
commit 17bbbe7fbc
4 changed files with 37 additions and 36 deletions

View File

@@ -1,34 +1,19 @@
FROM node:25-alpine AS base
FROM node:25-alpine
WORKDIR /app
# Dependencies stage
FROM base AS deps
# Install dependencies
COPY package*.json ./
RUN npm install --production
# Production stage
FROM base AS production
COPY --from=deps /app/node_modules ./node_modules
# Copy application code
COPY . .
# Copy init script
COPY scripts/init-data-dir.sh /usr/local/bin/init-data-dir.sh
RUN chmod +x /usr/local/bin/init-data-dir.sh
EXPOSE 3000
# Create a non-root user
RUN addgroup -g 1001 -S nodejs
RUN adduser -S nextjs -u 1001
# Create directory for database
RUN mkdir -p /app/data
USER nextjs
# Create directory for database with open permissions
RUN mkdir -p /app/data && chmod 777 /app/data
# Set environment variable for database path
ENV DB_PATH=/app/data/data.db
# Use init script as entrypoint wrapper
ENTRYPOINT ["/usr/local/bin/init-data-dir.sh"]
EXPOSE 3000
CMD ["node", "server.js"]