-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6e50534
commit 03f9085
Showing
1 changed file
with
37 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,59 @@ | ||
# Build all the things | ||
FROM node:18.15.0-bullseye-slim as build | ||
FROM node:20.5-bullseye-slim AS build | ||
RUN apt-get update -y && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y \ | ||
build-essential \ | ||
gcc autoconf \ | ||
automake \ | ||
zlib1g-dev \ | ||
libpng-dev \ | ||
nasm bash \ | ||
libvips-dev \ | ||
&& apt-get clean | ||
|
||
apt-get upgrade -y && \ | ||
apt-get install -y libc6 && \ | ||
apt-get clean | ||
ENV NODE_ENV production | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
WORKDIR /app | ||
|
||
COPY .yarn ./.yarn | ||
COPY package.json .yarnrc.yml yarn.lock ./ | ||
COPY public ./public | ||
COPY src ./src | ||
|
||
COPY .browserslistrc \ | ||
.yarnrc.yml \ | ||
components.json \ | ||
entrypoint.sh \ | ||
index.js \ | ||
logger.js \ | ||
next.config.mjs \ | ||
package.json \ | ||
postcss.config.js \ | ||
README.md \ | ||
tailwind.config.ts \ | ||
tsconfig.json \ | ||
yarn.lock \ | ||
.env.local \ | ||
./ | ||
|
||
WORKDIR /app/cms | ||
COPY ./cms/package.json ./ | ||
RUN yarn install | ||
|
||
COPY ./cms . | ||
RUN yarn prebuild | ||
RUN yarn build | ||
|
||
# Copy only the built files into the final image | ||
FROM node:18.15.0-bullseye-slim AS runner | ||
RUN apt-get update -y && \ | ||
apt-get upgrade -y && \ | ||
apt-get install -y libvips-dev && \ | ||
apt-get clean | ||
|
||
FROM node:20.5-bullseye-slim AS runner | ||
ENV NODE_ENV production | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
|
||
WORKDIR /app | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 strapi | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY --from=build --chown=strapi:nodejs /app/cms ./ | ||
COPY --from=build --chown=nextjs:nodejs /app/.next ./.next | ||
COPY --from=build --chown=nextjs:nodejs /app/entrypoint.sh ./entrypoint.sh | ||
COPY --from=build /app/node_modules ./node_modules | ||
COPY --from=build /app/public ./public | ||
COPY --from=build /app/package.json ./package.json | ||
COPY --from=build /app/index.js ./index.js | ||
COPY --from=build /app/.env.local ./.env.local | ||
|
||
USER nextjs | ||
|
||
USER strapi | ||
EXPOSE 3000 | ||
ENV PORT 3000 | ||
|
||
EXPOSE 1337 | ||
ENTRYPOINT ["/app/entrypoint.sh"] |