Fix EACCES on /app/package.json in Docker
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 5s
All checks were successful
Publish Docker Image / Publish Docker Image (push) Successful in 5s
This commit is contained in:
14
Dockerfile
14
Dockerfile
@@ -4,7 +4,8 @@ ENV NEXT_PUBLIC_APP_VERSION=$APP_VERSION
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable && corepack prepare yarn@4.9.1 --activate
|
||||
RUN corepack enable
|
||||
RUN corepack prepare yarn@4.12.0 --activate
|
||||
|
||||
COPY package.json yarn.lock .yarnrc.yml ./
|
||||
RUN yarn install --immutable
|
||||
@@ -22,9 +23,10 @@ LABEL org.opencontainers.image.version=$APP_VERSION
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN corepack enable && corepack prepare yarn@4.9.1 --activate \
|
||||
&& addgroup -S nodejs -g 1001 \
|
||||
&& adduser -S nextjs -u 1001
|
||||
RUN corepack enable
|
||||
RUN corepack prepare yarn@4.12.0 --activate
|
||||
RUN addgroup -S nodejs -g 1001
|
||||
RUN adduser -S nextjs -u 1001
|
||||
|
||||
COPY --from=builder /app/yarn.lock ./yarn.lock
|
||||
COPY --from=builder /app/.yarnrc.yml ./.yarnrc.yml
|
||||
@@ -33,8 +35,8 @@ COPY --from=builder /app/public ./public
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/package.json ./package.json
|
||||
|
||||
RUN mkdir -p /app/.yarn && chown -R nextjs:nodejs /app/.yarn
|
||||
RUN mkdir -p /app/.next/cache/images && chown -R nextjs:nodejs /app/.next/cache/images
|
||||
RUN mkdir -p /app/.yarn /app/.next/cache/images
|
||||
RUN chown -R nextjs:nodejs /app
|
||||
|
||||
USER nextjs
|
||||
EXPOSE 3000
|
||||
|
||||
Reference in New Issue
Block a user