fix permissions and db

This commit is contained in:
ismail 2026-02-02 19:35:49 +01:00
parent a43f371022
commit b270cbaba4
2 changed files with 10 additions and 7 deletions

View File

@ -35,20 +35,21 @@ WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
RUN addgroup --system --gid 1001 nodejs # Use existing node user (UID 1000) to match host permissions
RUN adduser --system --uid 1001 nextjs # RUN addgroup --system --gid 1001 nodejs
# RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public COPY --from=builder /app/public ./public
# Set the correct permission for prerender cache # Set the correct permission for prerender cache
RUN mkdir .next RUN mkdir .next
RUN chown nextjs:nodejs .next RUN chown node:node .next
# Automatically leverage output traces to reduce image size # Automatically leverage output traces to reduce image size
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=node:node /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static COPY --from=builder --chown=node:node /app/.next/static ./.next/static
USER nextjs USER node
EXPOSE 3000 EXPOSE 3000

View File

@ -46,9 +46,11 @@ CREATE TABLE IF NOT EXISTS categories (
description TEXT, description TEXT,
image_url VARCHAR(500), image_url VARCHAR(500),
show_on_homepage BOOLEAN DEFAULT FALSE, show_on_homepage BOOLEAN DEFAULT FALSE,
parent_id INT DEFAULT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
INDEX idx_name (name) INDEX idx_name (name),
FOREIGN KEY (parent_id) REFERENCES categories(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- 6. Create products table (Full version) -- 6. Create products table (Full version)