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
|
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 ./
|
COPY package.json yarn.lock .yarnrc.yml ./
|
||||||
RUN yarn install --immutable
|
RUN yarn install --immutable
|
||||||
@@ -22,9 +23,10 @@ LABEL org.opencontainers.image.version=$APP_VERSION
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
RUN corepack enable && corepack prepare yarn@4.9.1 --activate \
|
RUN corepack enable
|
||||||
&& addgroup -S nodejs -g 1001 \
|
RUN corepack prepare yarn@4.12.0 --activate
|
||||||
&& adduser -S nextjs -u 1001
|
RUN addgroup -S nodejs -g 1001
|
||||||
|
RUN adduser -S nextjs -u 1001
|
||||||
|
|
||||||
COPY --from=builder /app/yarn.lock ./yarn.lock
|
COPY --from=builder /app/yarn.lock ./yarn.lock
|
||||||
COPY --from=builder /app/.yarnrc.yml ./.yarnrc.yml
|
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/node_modules ./node_modules
|
||||||
COPY --from=builder /app/package.json ./package.json
|
COPY --from=builder /app/package.json ./package.json
|
||||||
|
|
||||||
RUN mkdir -p /app/.yarn && chown -R nextjs:nodejs /app/.yarn
|
RUN mkdir -p /app/.yarn /app/.next/cache/images
|
||||||
RUN mkdir -p /app/.next/cache/images && chown -R nextjs:nodejs /app/.next/cache/images
|
RUN chown -R nextjs:nodejs /app
|
||||||
|
|
||||||
USER nextjs
|
USER nextjs
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|||||||
Reference in New Issue
Block a user