From 63fd9a4a4588e72af3e00f6e908314b1319f64ee Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Thu, 6 Mar 2025 00:32:56 +0800 Subject: [PATCH] chore(docker): change default USER to root in Dockerfile and remove user: root in Compose --- Dockerfile | 5 +---- compose.local.yml | 1 - compose.yml | 1 - 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1384af0..eabeec8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,9 +60,6 @@ ENV NODE_ENV=production # Uncomment the following line in case you want to disable telemetry during runtime. ENV NEXT_TELEMETRY_DISABLED=1 -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs - COPY --from=builder /app/public ./public # Automatically leverage output traces to reduce image size @@ -70,7 +67,7 @@ COPY --from=builder /app/public ./public COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static -USER nextjs +USER root EXPOSE 3000 diff --git a/compose.local.yml b/compose.local.yml index bb925d2..90c331f 100644 --- a/compose.local.yml +++ b/compose.local.yml @@ -19,7 +19,6 @@ services: timeout: 5s retries: 5 start_period: 10s - user: root volumes: - /var/run/docker.sock:/var/run/docker.sock diff --git a/compose.yml b/compose.yml index aeaeca0..3cb61ab 100644 --- a/compose.yml +++ b/compose.yml @@ -16,7 +16,6 @@ services: timeout: 5s retries: 5 start_period: 10s - user: root volumes: - /var/run/docker.sock:/var/run/docker.sock