Merge Dev in Staging

This commit is contained in:
Arnaud D. Natali 2023-11-07 17:01:57 +01:00 committed by GitHub
commit af019d3d26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 125 additions and 4 deletions

View File

@ -8,8 +8,69 @@ jobs:
build-push-docker-image: build-push-docker-image:
docker: docker:
- image: cimg/base:stable - image: cimg/base:stable
parameters:
NEXT_PUBLIC_BACK_API_HOST:
type: string
default: ""
NEXT_PUBLIC_BACK_API_PROTOCOL:
type: string
default: ""
NEXT_PUBLIC_BACK_API_ROOT_URL:
type: string
default: ""
NEXT_PUBLIC_BACK_API_VERSION:
type: string
default: ""
NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT:
type: string
default: ""
NEXT_PUBLIC_FC_CLIENT_ID:
type: string
default: ""
NEXT_PUBLIC_FRONT_APP_HOST:
type: string
default: ""
NEXT_PUBLIC_FRONT_APP_PORT:
type: string
default: ""
NEXT_PUBLIC_IDNOT_BASE_URL:
type: string
default: ""
NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT:
type: string
default: ""
NEXT_PUBLIC_IDNOT_CLIENT_ID:
type: string
default: ""
NEXT_PUBLIC_DOCAPOST_API_URL:
type: string
default: ""
NEXT_PUBLIC_DOCAPOST_DOCUMENT_PROCESS_ID:
type: string
default: ""
NEXT_PUBLIC_DOCAPOST_CONNECT_PROCESS_ID:
type: string
default: ""
NEXT_PUBLIC_DOCAPOST_APP_ID:
type: string
default: ""
environment: environment:
TAG: << pipeline.git.tag >> TAG: << pipeline.git.tag >>
NEXT_PUBLIC_BACK_API_HOST: << parameters.NEXT_PUBLIC_BACK_API_HOST >>
NEXT_PUBLIC_BACK_API_PROTOCOL: << parameters.NEXT_PUBLIC_BACK_API_PROTOCOL >>
NEXT_PUBLIC_BACK_API_ROOT_URL: << parameters.NEXT_PUBLIC_BACK_API_ROOT_URL >>
NEXT_PUBLIC_BACK_API_VERSION: << parameters.NEXT_PUBLIC_BACK_API_VERSION >>
NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT: << parameters.NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT >>
NEXT_PUBLIC_FC_CLIENT_ID: << parameters.NEXT_PUBLIC_FC_CLIENT_ID >>
NEXT_PUBLIC_FRONT_APP_HOST: << parameters.NEXT_PUBLIC_FRONT_APP_HOST >>
NEXT_PUBLIC_FRONT_APP_PORT: << parameters.NEXT_PUBLIC_FRONT_APP_PORT >>
NEXT_PUBLIC_IDNOT_BASE_URL: << parameters.NEXT_PUBLIC_IDNOT_BASE_URL >>
NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT: << parameters.NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT >>
NEXT_PUBLIC_IDNOT_CLIENT_ID: << parameters.NEXT_PUBLIC_IDNOT_CLIENT_ID >>
NEXT_PUBLIC_DOCAPOST_API_URL: << parameters.NEXT_PUBLIC_DOCAPOST_API_URL >>
NEXT_PUBLIC_DOCAPOST_DOCUMENT_PROCESS_ID: << parameters.NEXT_PUBLIC_DOCAPOST_DOCUMENT_PROCESS_ID >>
NEXT_PUBLIC_DOCAPOST_CONNECT_PROCESS_ID: << parameters.NEXT_PUBLIC_DOCAPOST_CONNECT_PROCESS_ID >>
NEXT_PUBLIC_DOCAPOST_APP_ID: << parameters.NEXT_PUBLIC_DOCAPOST_APP_ID >>
steps: steps:
- checkout - checkout
- add_ssh_keys: - add_ssh_keys:
@ -52,6 +113,21 @@ workflows:
build-and-register-stg: build-and-register-stg:
jobs: jobs:
- build-push-docker-image: - build-push-docker-image:
NEXT_PUBLIC_BACK_API_HOST: api.stg.lecoffre.smart-chain.fr
NEXT_PUBLIC_BACK_API_PROTOCOL: https://
NEXT_PUBLIC_BACK_API_ROOT_URL: /api
NEXT_PUBLIC_BACK_API_VERSION: /v1
NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT: https://fcp.integ01.dev-franceconnect.fr/api/v1/authorize
NEXT_PUBLIC_FC_CLIENT_ID: 211286433e39cce01db448d80181bdfd005554b19cd51b3fe7943f6b3b86ab6e
NEXT_PUBLIC_FRONT_APP_HOST: https://app.stg.lecoffre.smart-chain.fr
NEXT_PUBLIC_FRONT_APP_PORT: "3000"
NEXT_PUBLIC_IDNOT_BASE_URL: "https://qual-connexion.idnot.fr"
NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT: "/IdPOAuth2/authorize/idnot_idp_v1"
NEXT_PUBLIC_IDNOT_CLIENT_ID: "4501646203F3EF67"
NEXT_PUBLIC_DOCAPOST_API_URL: "https://preprod.id360docaposte.com/api/1.0.0"
NEXT_PUBLIC_DOCAPOST_DOCUMENT_PROCESS_ID: 49508376-b160-475d-9224-9bb6511215b8
NEXT_PUBLIC_DOCAPOST_CONNECT_PROCESS_ID: 54c14875-f864-4819-8cd4-4fc6dd4a947b
NEXT_PUBLIC_DOCAPOST_APP_ID: leCoffre@smart_chain
context: context:
- sc-shared-prd - sc-shared-prd
filters: filters:
@ -70,6 +146,21 @@ workflows:
build-and-register-ppd: build-and-register-ppd:
jobs: jobs:
- build-push-docker-image: - build-push-docker-image:
NEXT_PUBLIC_BACK_API_HOST: api.ppd.lecoffre.smart-chain.fr
NEXT_PUBLIC_BACK_API_PROTOCOL: https://
NEXT_PUBLIC_BACK_API_ROOT_URL: /api
NEXT_PUBLIC_BACK_API_VERSION: /v1
NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT: https://fcp.integ01.dev-franceconnect.fr/api/v1/authorize
NEXT_PUBLIC_FC_CLIENT_ID: 211286433e39cce01db448d80181bdfd005554b19cd51b3fe7943f6b3b86ab6e
NEXT_PUBLIC_FRONT_APP_HOST: https://app.ppd.lecoffre.smart-chain.fr
NEXT_PUBLIC_FRONT_APP_PORT: "3000"
NEXT_PUBLIC_IDNOT_BASE_URL: "https://qual-connexion.idnot.fr"
NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT: "/IdPOAuth2/authorize/idnot_idp_v1"
NEXT_PUBLIC_IDNOT_CLIENT_ID: "4501646203F3EF67"
NEXT_PUBLIC_DOCAPOST_API_URL: "https://preprod.id360docaposte.com/api/1.0.0"
NEXT_PUBLIC_DOCAPOST_DOCUMENT_PROCESS_ID: 49508376-b160-475d-9224-9bb6511215b8
NEXT_PUBLIC_DOCAPOST_CONNECT_PROCESS_ID: 54c14875-f864-4819-8cd4-4fc6dd4a947b
NEXT_PUBLIC_DOCAPOST_APP_ID: leCoffre@smart_chain
context: context:
- sc-shared-prd - sc-shared-prd
filters: filters:
@ -88,6 +179,21 @@ workflows:
build-and-register-prd: build-and-register-prd:
jobs: jobs:
- build-push-docker-image: - build-push-docker-image:
NEXT_PUBLIC_BACK_API_HOST: api.lecoffre.smart-chain.fr
NEXT_PUBLIC_BACK_API_PROTOCOL: https://
NEXT_PUBLIC_BACK_API_ROOT_URL: /api
NEXT_PUBLIC_BACK_API_VERSION: /v1
NEXT_PUBLIC_FC_AUTHORIZE_ENDPOINT: https://fcp.integ01.dev-franceconnect.fr/api/v1/authorize
NEXT_PUBLIC_FC_CLIENT_ID: 211286433e39cce01db448d80181bdfd005554b19cd51b3fe7943f6b3b86ab6e
NEXT_PUBLIC_FRONT_APP_HOST: https://app.lecoffre.smart-chain.fr
NEXT_PUBLIC_FRONT_APP_PORT: "3000"
NEXT_PUBLIC_IDNOT_BASE_URL: "https://qual-connexion.idnot.fr"
NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT: "/IdPOAuth2/authorize/idnot_idp_v1"
NEXT_PUBLIC_IDNOT_CLIENT_ID: "4501646203F3EF67"
NEXT_PUBLIC_DOCAPOST_API_URL: "https://preprod.id360docaposte.com/api/1.0.0"
NEXT_PUBLIC_DOCAPOST_DOCUMENT_PROCESS_ID: 49508376-b160-475d-9224-9bb6511215b8
NEXT_PUBLIC_DOCAPOST_CONNECT_PROCESS_ID: 54c14875-f864-4819-8cd4-4fc6dd4a947b
NEXT_PUBLIC_DOCAPOST_APP_ID: leCoffre@smart_chain
context: context:
- sc-shared-prd - sc-shared-prd
filters: filters:

View File

@ -12,7 +12,7 @@ RUN chmod 600 ~/.ssh/id_rsa
RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa RUN eval "$(ssh-agent -s)" && ssh-add /root/.ssh/id_rsa
RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/known_hosts RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/known_hosts
RUN npm install --frozen-lockfile # RUN npm install --frozen-lockfile
# Rebuild the source code only when needed # Rebuild the source code only when needed
FROM node:19-alpine AS builder FROM node:19-alpine AS builder
@ -22,8 +22,8 @@ WORKDIR leCoffre-front
COPY --from=deps leCoffre-front/node_modules ./node_modules COPY --from=deps leCoffre-front/node_modules ./node_modules
COPY --from=deps leCoffre-front/package.json package.json COPY --from=deps leCoffre-front/package.json package.json
COPY tsconfig.json tsconfig.json COPY tsconfig.json tsconfig.json
COPY next.config.js next.config.js
COPY src src COPY src src
COPY .env .env
RUN npm run build RUN npm run build
@ -35,9 +35,9 @@ WORKDIR leCoffre-front
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser . RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
COPY public ./public COPY public ./public
COPY --from=builder --chown=lecoffreuser leCoffre-front/.env ./.env
COPY --from=builder --chown=lecoffreuser leCoffre-front/node_modules ./node_modules COPY --from=builder --chown=lecoffreuser leCoffre-front/node_modules ./node_modules
COPY --from=builder --chown=lecoffreuser leCoffre-front/.next ./.next COPY --from=builder --chown=lecoffreuser leCoffre-front/.next ./.next
COPY --from=builder --chown=lecoffreuser leCoffre-front/next.config.js ./next.config.js
COPY --from=builder --chown=lecoffreuser leCoffre-front/package.json ./package.json COPY --from=builder --chown=lecoffreuser leCoffre-front/package.json ./package.json
USER lecoffreuser USER lecoffreuser

View File

@ -28,6 +28,20 @@ const nextConfig = {
NEXT_PUBLIC_IDNOT_BASE_URL: process.env.NEXT_PUBLIC_IDNOT_BASE_URL, NEXT_PUBLIC_IDNOT_BASE_URL: process.env.NEXT_PUBLIC_IDNOT_BASE_URL,
NEXT_PUBLIC_DOCAPOSTE_API_URL: process.env.NEXT_PUBLIC_DOCAPOSTE_API_URL, NEXT_PUBLIC_DOCAPOSTE_API_URL: process.env.NEXT_PUBLIC_DOCAPOSTE_API_URL,
}, },
env: {
NEXT_PUBLIC_BACK_API_PROTOCOL: process.env.NEXT_PUBLIC_BACK_API_PROTOCOL,
NEXT_PUBLIC_BACK_API_HOST: process.env.NEXT_PUBLIC_BACK_API_HOST,
NEXT_PUBLIC_BACK_API_ROOT_URL: process.env.NEXT_PUBLIC_BACK_API_ROOT_URL,
NEXT_PUBLIC_BACK_API_VERSION: process.env.NEXT_PUBLIC_BACK_API_VERSION,
NEXT_PUBLIC_FRONT_APP_HOST: process.env.NEXT_PUBLIC_FRONT_APP_HOST,
NEXT_PUBLIC_FRONT_APP_PORT: process.env.NEXT_PUBLIC_FRONT_APP_PORT,
NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT: process.env.NEXT_PUBLIC_IDNOT_AUTHORIZE_ENDPOINT,
NEXT_PUBLIC_IDNOT_CLIENT_ID: process.env.NEXT_PUBLIC_IDNOT_CLIENT_ID,
NEXT_PUBLIC_IDNOT_BASE_URL: process.env.NEXT_PUBLIC_IDNOT_BASE_URL,
NEXT_PUBLIC_DOCAPOSTE_API_URL: process.env.NEXT_PUBLIC_DOCAPOSTE_API_URL,
},
// webpack: config => { // webpack: config => {
// config.node = { // config.node = {
// fs: 'empty', // fs: 'empty',

View File

@ -26,7 +26,7 @@ type AppPropsWithLayout = AppProps & {
docaposteApiUrl: string; docaposteApiUrl: string;
}; };
const { publicRuntimeConfig, serverRuntimeConfig } = getConfig(); const { publicRuntimeConfig, serverRuntimeConfig, env } = getConfig();
const MyApp = (({ const MyApp = (({
Component, Component,
@ -67,6 +67,7 @@ MyApp.getInitialProps = async () => {
console.log("runtime config", publicRuntimeConfig); console.log("runtime config", publicRuntimeConfig);
console.log("server runtime config", serverRuntimeConfig); console.log("server runtime config", serverRuntimeConfig);
console.log("process env", process.env['NEXT_PUBLIC_BACK_API_PROTOCOL'] || "env undefined"); console.log("process env", process.env['NEXT_PUBLIC_BACK_API_PROTOCOL'] || "env undefined");
console.log("env config", env);
return { return {
backApiProtocol: publicRuntimeConfig.NEXT_PUBLIC_BACK_API_PROTOCOL, backApiProtocol: publicRuntimeConfig.NEXT_PUBLIC_BACK_API_PROTOCOL,
backApiHost: publicRuntimeConfig.NEXT_PUBLIC_BACK_API_HOST, backApiHost: publicRuntimeConfig.NEXT_PUBLIC_BACK_API_HOST,