-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(site): Nouvelle image Docker mieux adaptée à la poduction (#3330)
- Loading branch information
1 parent
9f24b6e
commit a080e47
Showing
7 changed files
with
164 additions
and
53 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,5 +1,7 @@ | ||
node_modules | ||
dist | ||
.git | ||
.env* | ||
.nx | ||
.vscode | ||
.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
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,3 +1,4 @@ | ||
NEXT_PUBLIC_SUPABASE_URL=http://localhost:8000 | ||
NEXT_PUBLIC_SUPABASE_ANON_KEY=${SUPABASE_ANON_KEY} | ||
NEXT_PUBLIC_CRISP_WEBSITE_ID="// Crisp integration (warning: use different ID by deployment env.)" | ||
NEXT_PUBLIC_AXEPTIO_ID=${AXEPTIO_ID} |
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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
VERSION 0.8 | ||
|
||
build: | ||
FROM ../../+node-alpine-with-all-deps | ||
|
||
ARG --required ANON_KEY | ||
ARG --required API_URL | ||
ARG --required STRAPI_KEY | ||
ARG --required STRAPI_URL | ||
ARG --required AXEPTIO_ID | ||
|
||
COPY . ./packages/site | ||
|
||
# Disable telemetry during build | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
|
||
ENV NEXT_PUBLIC_STRAPI_KEY=$STRAPI_KEY | ||
ENV NEXT_PUBLIC_STRAPI_URL=$STRAPI_URL | ||
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$ANON_KEY | ||
ENV NEXT_PUBLIC_SUPABASE_URL=$API_URL | ||
ENV NEXT_PUBLIC_POSTHOG_HOST=$POSTHOG_HOST | ||
ENV NEXT_PUBLIC_POSTHOG_KEY=$POSTHOG_KEY | ||
ENV NEXT_PUBLIC_AXEPTIO_ID=$AXEPTIO_ID | ||
ENV NEXT_PUBLIC_CRISP_WEBSITE_ID=$CRISP_WEBSITE_ID | ||
|
||
RUN pnpm build:site | ||
|
||
SAVE ARTIFACT ./packages/site/.next | ||
SAVE ARTIFACT ./packages/site/public | ||
|
||
# See official Dockerfile at https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile | ||
docker: | ||
FROM ../../+node-alpine | ||
|
||
ARG --required ANON_KEY | ||
ARG --required API_URL | ||
ARG --required STRAPI_KEY | ||
ARG --required STRAPI_URL | ||
ARG --required AXEPTIO_ID | ||
ARG POSTHOG_HOST | ||
ARG POSTHOG_KEY | ||
|
||
ENV NEXT_PUBLIC_STRAPI_KEY=$STRAPI_KEY | ||
ENV NEXT_PUBLIC_STRAPI_URL=$STRAPI_URL | ||
ENV NEXT_PUBLIC_SUPABASE_ANON_KEY=$ANON_KEY | ||
ENV NEXT_PUBLIC_SUPABASE_URL=$API_URL | ||
ENV NEXT_PUBLIC_POSTHOG_HOST=$POSTHOG_HOST | ||
ENV NEXT_PUBLIC_POSTHOG_KEY=$POSTHOG_KEY | ||
ENV NEXT_PUBLIC_AXEPTIO_ID=$AXEPTIO_ID | ||
ENV NEXT_PUBLIC_CRISP_WEBSITE_ID=$CRISP_WEBSITE_ID | ||
|
||
ARG DOCKER_IMAGE=$SITE_IMG_NAME | ||
|
||
# ENV PUBLIC_PATH="/app/public" | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
COPY +build/public ./public | ||
|
||
# Set the correct permission for prerender cache | ||
RUN mkdir .next | ||
RUN chown nextjs:nodejs .next | ||
|
||
# Automatically leverage output traces to reduce docker image size | ||
# https://nextjs.org/docs/advanced-features/output-file-tracing | ||
COPY --chown=nextjs:nodejs +build/.next/standalone ./ | ||
COPY --chown=nextjs:nodejs +build/.next/static ./packages/site/.next/static | ||
|
||
USER nextjs | ||
|
||
|
||
# Prepare the app for production | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
ENV HOSTNAME="0.0.0.0" | ||
ENV NODE_ENV production | ||
|
||
ENV PORT=3000 | ||
EXPOSE 3000 | ||
|
||
# server.js is created by next build from the standalone output | ||
# https://nextjs.org/docs/pages/api-reference/next-config-js/output | ||
CMD ["node", "packages/site/server.js"] | ||
|
||
SAVE IMAGE --push $DOCKER_IMAGE | ||
|
||
deploy: | ||
ARG --required KOYEB_API_KEY | ||
FROM ../../+koyeb --KOYEB_API_KEY=$KOYEB_API_KEY | ||
RUN ./koyeb services update $ENV_NAME-site/front --docker $SITE_IMG_NAME | ||
|
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