-
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.
- bump node to 22 - use nginx as static http server Signed-off-by: Guillaume Bonnet <[email protected]>
- Loading branch information
Showing
4 changed files
with
120 additions
and
143 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,42 +1,29 @@ | ||
FROM node:20-alpine AS base | ||
FROM node:22-alpine AS base | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV APP_DIRECTORY="/usr/src/app" | ||
|
||
ENV PATH="${PATH}:${PNPM_HOME}" | ||
ENV PATH="${PATH}:${APP_DIRECTORY}/node_modules/.bin/" | ||
ENV PATH="${PATH}:${APP_DIRECTORY}/docs/node_modules/.bin/" | ||
ENV TURBO_TELEMETRY_DISABLED="1" | ||
ENV ASTRO_TELEMETRY_DISABLED="1" | ||
|
||
RUN corepack enable pnpm | ||
|
||
WORKDIR ${APP_DIRECTORY} | ||
WORKDIR "/usr/src/app" | ||
|
||
COPY ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml ./ | ||
RUN corepack enable pnpm | ||
COPY ./docs/package.json ./docs/ | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
|
||
FROM base AS build | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
COPY ./turbo.json ./turbo.json | ||
COPY ./docs ./docs | ||
RUN pnpm build | ||
|
||
|
||
FROM base | ||
|
||
COPY --from=build ${APP_DIRECTORY}/docs/dist/ ./docs/dist/ | ||
|
||
ENV NODE_ENV="production" | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile | ||
|
||
RUN apk add --no-cache dumb-init | ||
|
||
EXPOSE 4321 | ||
FROM nginx:stable-alpine AS production | ||
|
||
ENTRYPOINT ["dumb-init", "--"] | ||
COPY --from=build /usr/src/app/docs/dist/ /usr/share/nginx/html | ||
|
||
CMD ["pnpm", "-F", "@sandwich-ui/docs", "preview", "--host"] | ||
EXPOSE 80 |
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
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,43 +1,33 @@ | ||
FROM node:20-alpine AS base | ||
FROM node:22-alpine AS base | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV APP_DIRECTORY="/usr/src/app" | ||
|
||
ENV PATH="${PATH}:${PNPM_HOME}" | ||
ENV PATH="${PATH}:${APP_DIRECTORY}/node_modules/.bin/" | ||
ENV PATH="${PATH}:${APP_DIRECTORY}/storybook/node_modules/.bin/" | ||
ENV TURBO_TELEMETRY_DISABLED="1" | ||
ENV STORYBOOK_DISABLE_TELEMETRY="1" | ||
|
||
RUN corepack enable pnpm | ||
|
||
WORKDIR ${APP_DIRECTORY} | ||
WORKDIR "/usr/src/app" | ||
|
||
COPY ./package.json ./pnpm-lock.yaml ./pnpm-workspace.yaml ./ | ||
RUN corepack enable pnpm | ||
COPY ./packages/core/package.json ./packages/core/ | ||
COPY ./packages/react/package.json ./packages/react/ | ||
COPY ./packages/react-storybook/package.json ./packages/react-storybook/ | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
|
||
FROM base AS build | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
COPY ./turbo.json ./turbo.json | ||
COPY ./packages/core ./packages/core | ||
COPY ./packages/react ./packages/react | ||
COPY ./packages/react-storybook ./packages/react-storybook | ||
RUN pnpm build | ||
|
||
|
||
FROM base | ||
|
||
COPY --from=build ${APP_DIRECTORY}/packages/react-storybook/storybook-static/ ./packages/react-storybook/storybook-static/ | ||
|
||
ENV NODE_ENV="production" | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile | ||
|
||
RUN apk add --no-cache dumb-init | ||
|
||
EXPOSE 4173 | ||
FROM nginx:stable-alpine AS production | ||
|
||
ENTRYPOINT ["dumb-init", "--"] | ||
COPY --from=build /usr/src/app/packages/react-storybook/storybook-static/ /usr/share/nginx/html | ||
|
||
CMD ["pnpm", "-F", "@sandwich-ui/react-storybook", "preview", "--host"] | ||
EXPOSE 80 |
Oops, something went wrong.