Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.

Commit

Permalink
feat: add build
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgfr committed Feb 18, 2022
1 parent 156ecb5 commit 478d434
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/preproduction.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,3 @@ jobs:
imageName: fabrique/${{ env.project }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
dockerbuildargs: |
PROJECT_ENV=staging
2 changes: 1 addition & 1 deletion .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
dockerbuildargs: |
PROJECT_ENV=production
PRODUCTION=true
2 changes: 0 additions & 2 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,3 @@ jobs:
imageName: fabrique/${{ env.project }}
rancherId: ${{ secrets.RANCHER_PROJECT_ID }}
socialgouvBaseDomain: ${{ secrets.SOCIALGOUV_BASE_DOMAIN }}
dockerbuildargs: |
PROJECT_ENV=staging
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ RUN yarn install --frozen-lockfile
# Rebuild the source code only when needed
FROM node:$NODE_VERSION AS builder
ENV NODE_ENV production
ARG PROJECT_ENV
ARG PRODUCTION
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN if [ "$PROJECT_ENV" = "staging" ]; then echo "Copy staging values"; cp .env.staging .env.production; cp ./public/robots.staging.txt ./public/robots.txt; fi
RUN yarn build:export
RUN if [ -z "$PRODUCTION" ]; then \
echo "Copy staging values"; \
cp .env.staging .env.production; cp ./public/robots.staging.txt ./public/robots.txt; \
fi \
&& yarn build:export

# Production image, copy all the files and run next
FROM ghcr.io/socialgouv/docker/nginx:6.64.2 AS runner
Expand Down
4 changes: 4 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ const { withSentryConfig } = require("@sentry/nextjs");
/** @type {import('next').NextConfig} */
const moduleExports = {
reactStrictMode: true,
sentry: {
disableClientWebpackPlugin: true,
disableServerWebpackPlugin: true,
},
};

const sentryWebpackPluginOptions = {
Expand Down
2 changes: 1 addition & 1 deletion public/sitemap-0.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://template.fabrique.social.gouv.fr</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2022-02-11T15:07:07.677Z</lastmod></url>
<url><loc>https://template.fabrique.social.gouv.fr</loc><changefreq>daily</changefreq><priority>0.7</priority><lastmod>2022-02-18T17:25:42.798Z</lastmod></url>
</urlset>
3 changes: 2 additions & 1 deletion src/components/footer/body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import {
FooterOperator,
} from "@dataesr/react-dsfr";
import { FooterBodySectionProps } from "./type";
import Image from "next/image";

export const Body = (props: FooterBodySectionProps): JSX.Element => (
<FooterBody description={props.description}>
<Logo>{props.ministryName}</Logo>
{props.image && (
<FooterOperator>
<img src={props.image.src} alt={props.image.alt} />
<Image src={props.image.src} alt={props.image.alt} />
</FooterOperator>
)}
{props.links?.map((link, index) => (
Expand Down
6 changes: 4 additions & 2 deletions src/components/header/body.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,18 @@ import {
Tool,
} from "@dataesr/react-dsfr";
import { HeaderBodyProps } from "./type";
import Image from "next/image";

export const Body = (props: HeaderBodyProps): JSX.Element => (
<HeaderBody>
<Logo splitCharacter={props.splitTitleLength ?? 10}>{props.mainTitle}</Logo>
{props.image && (
<HeaderOperator>
<img
<Image
src={props.image.src}
alt={props.image.alt}
style={{ height: props.image.height, width: props.image.width }}
height={props.image.height}
width={props.image.width}
/>
</HeaderOperator>
)}
Expand Down

0 comments on commit 478d434

Please sign in to comment.