-
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.
Signed-off-by: Giovanni Ravalico <[email protected]>
- Loading branch information
1 parent
43b1e79
commit 235803f
Showing
4 changed files
with
31 additions
and
26 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,7 +1,8 @@ | ||
.idea/ | ||
.git/ | ||
.github/ | ||
node_modules/ | ||
.DS_Store | ||
.dockerignore | ||
docker-compose.yml | ||
Dockerfile | ||
.github/ |
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,56 +1,60 @@ | ||
# base node image | ||
FROM node:21-alpine3.19@sha256:d3271e4bd89eec4d97087060fd4db0c238d9d22fcfad090a73fa9b5128699888 AS base | ||
FROM node:21-alpine3.19 AS base | ||
|
||
LABEL authors="suddenlyGiovanni" | ||
|
||
# set for base and all layer that inherit from it | ||
ENV PNPM_HOME="/pnpm" | ||
|
||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
RUN apk add --no-cache libc6-compat | ||
RUN corepack enable | ||
|
||
RUN apk update | ||
WORKDIR /home/node/ | ||
|
||
RUN corepack enable | ||
FROM base AS builder | ||
|
||
COPY . /app | ||
WORKDIR /home/node/builder | ||
|
||
WORKDIR /app | ||
RUN pnpm add --global turbo | ||
|
||
#ENTRYPOINT ["sh"] | ||
COPY . . | ||
|
||
RUN turbo prune --docker @suddenly-giovanni/web | ||
|
||
FROM base AS prod-deps | ||
ENTRYPOINT ["sh"] | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile | ||
FROM base AS build | ||
|
||
#ENTRYPOINT ["sh"] | ||
WORKDIR /home/node/build | ||
|
||
COPY .gitignore .gitignore | ||
|
||
FROM base AS build | ||
COPY --from=builder /home/node/builder/out/json/ . | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prod=false | ||
|
||
# Build the project | ||
COPY --from=builder /home/node/builder/out/full/ . | ||
|
||
ENV NODE_ENV production | ||
|
||
RUN pnpm run build | ||
RUN pnpm turbo build --filter=@suddenly-giovanni/web | ||
|
||
#ENTRYPOINT ["sh"] | ||
RUN pnpm --filter @suddenly-giovanni/web --prod deploy pruned | ||
|
||
|
||
FROM base AS runner | ||
FROM base AS production | ||
|
||
ENV NODE_ENV production | ||
|
||
COPY --from=prod-deps /app/node_modules /app/node_modules | ||
COPY --from=prod-deps /app/apps/web/node_modules /app/apps/web/node_modules | ||
COPY --from=build /app/apps/web/build /app/apps/web/build | ||
WORKDIR /home/node/code | ||
|
||
RUN apk add --no-cache dumb-init | ||
|
||
COPY --from=build --chown=node:node /home/node/build/pruned . | ||
COPY --from=build --chown=node:node /home/node/build/apps/web/build ./build | ||
|
||
USER node | ||
|
||
EXPOSE 3000 | ||
|
||
WORKDIR /app/apps/web | ||
|
||
CMD ["pnpm", "run", "start"] | ||
CMD ["dumb-init", "pnpm", "run", "start"] |
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