Skip to content

Commit ded24bb

Browse files
committed
feat: enhance Docker and CI/CD configurations, add environment variable handling, and update dependencies
1 parent 16817a4 commit ded24bb

File tree

7 files changed

+129
-28
lines changed

7 files changed

+129
-28
lines changed

.dockerignore

Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,88 @@
1+
# Dependencies
12
node_modules/
3+
.pnp
4+
.pnp.js
5+
6+
# Build outputs
27
.turbo/
38
dist/
4-
.env
5-
.nuxt/
69
.output/
10+
.nuxt/
11+
apps/*/dist/
12+
apps/*/.output/
13+
apps/*/.nuxt/
14+
15+
# Environment files
16+
.env
17+
.env.*
18+
!.env.example
19+
20+
# Git
21+
.git/
22+
.gitignore
23+
.gitattributes
24+
25+
# CI/CD
26+
.github/
27+
.gitlab-ci.yml
28+
29+
# IDE
30+
.vscode/
31+
.idea/
32+
*.swp
33+
*.swo
34+
*~
35+
.DS_Store
36+
37+
# Logs
38+
logs/
39+
*.log
40+
npm-debug.log*
41+
yarn-debug.log*
42+
yarn-error.log*
43+
lerna-debug.log*
44+
45+
# Testing
46+
coverage/
47+
.nyc_output/
48+
*.test.ts
49+
*.spec.ts
50+
**/__tests__/
51+
**/__mocks__/
52+
*.test.js
53+
*.spec.js
54+
55+
# Documentation
56+
*.md
57+
!README.md
58+
docs/
59+
CHANGELOG.md
60+
LICENSE
61+
62+
# Docker
63+
Dockerfile*
64+
docker-compose*.yml
65+
.dockerignore
66+
67+
# Development files
68+
.prettierrc*
69+
.eslintrc*
70+
.editorconfig
71+
tsconfig*.json
72+
jest.config.*
73+
vitest.config.*
74+
*.config.ts
75+
*.config.js
76+
!nuxt.config.ts
77+
78+
# Cache
79+
.cache/
80+
.temp/
81+
tmp/
82+
*.cache
83+
84+
# Misc
85+
.husky/
86+
.commitlintrc*
87+
.nvmrc
88+
.node-version

.github/workflows/docker-image.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ jobs:
4040
with:
4141
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4242

43+
- name: Extract version and commit info
44+
id: version
45+
run: |
46+
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
47+
echo "build_id=${{ github.sha }}" >> $GITHUB_OUTPUT
48+
4349
- name: Build and push Docker image
4450
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
4551
with:
@@ -48,3 +54,5 @@ jobs:
4854
tags: ${{ steps.meta.outputs.tags }}
4955
labels: ${{ steps.meta.outputs.labels }}
5056
platforms: linux/amd64
57+
build-args: |
58+
BUILD_VERSION=${{ steps.version.outputs.version }}-${{ steps.version.outputs.build_id }}

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ jobs:
4242
password: ${{ secrets.GITHUB_TOKEN }}
4343
access_token: ${{ secrets.GITHUB_TOKEN }}
4444
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
build-args: BUILD_VERSION={{NEW_VERSION}}

Dockerfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ RUN yarn run build
1515
FROM node:22-alpine AS production
1616

1717
ARG NODE_ENV=production
18+
ARG BUILD_VERSION=dev
1819
ENV NODE_ENV=${NODE_ENV}
20+
ENV BUILD_VERSION=${BUILD_VERSION}
1921
ENV ALLOW_RUNTIME_BUILD=true
2022
ENV DO_NOT_TRACK=1
2123
ENV PYTHONWARNINGS=ignore::UserWarning
@@ -36,9 +38,8 @@ RUN apk add --no-cache \
3638
git \
3739
jq \
3840
bash \
39-
nano
40-
41-
RUN mkdir -p /var/log/supervisor
41+
nano && \
42+
mkdir -p /var/log/supervisor
4243

4344
RUN ARCH=$(uname -m) && \
4445
if [ "$ARCH" = "x86_64" ]; then \
@@ -53,7 +54,16 @@ RUN yarn install \
5354
--prefer-offline \
5455
--pure-lockfile \
5556
--non-interactive \
56-
--production=false
57+
--production=true && \
58+
yarn cache clean && \
59+
find /data/node_modules -name "*.md" -delete && \
60+
find /data/node_modules -name "*.map" -delete && \
61+
find /data/node_modules -name "*.ts" -not -path "*/node_modules/@types/*" -delete && \
62+
find /data/node_modules -type d -name "__tests__" -exec rm -rf {} + 2>/dev/null || true && \
63+
find /data/node_modules -type d -name "test" -exec rm -rf {} + 2>/dev/null || true && \
64+
find /data/node_modules -type d -name "tests" -exec rm -rf {} + 2>/dev/null || true && \
65+
find /data/node_modules -type d -name "docs" -exec rm -rf {} + 2>/dev/null || true && \
66+
rm -rf /tmp/* /var/cache/apk/* /root/.npm /root/.node-gyp
5767

5868
COPY --from=builder /data/apps/api/dist ./apps/api/dist
5969
COPY --from=builder /data/apps/api/configs ./apps/api/configs

apps/web/nuxt.config.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,14 +262,14 @@ export default defineNuxtConfig({
262262
console.debug('[Nuxt] Error while reading identities-columns.yml', error)
263263
}
264264

265-
console.log('[OpenapiTS] Generating .nuxt/types/service-api.d.ts...')
266-
try {
267-
const fileData = await openapiTS(`${SESAME_APP_API_URL}/swagger/json`)
268-
writeFileSync('.nuxt/types/service-api.d.ts', String(fileData))
269-
console.log('[OpenapiTS] Generated .nuxt/types/service-api.d.ts !')
270-
} catch (error) {
271-
console.debug('[OpenapiTS] Error while generating .nuxt/types/service-api.d.ts', error)
272-
}
265+
// console.log('[OpenapiTS] Generating .nuxt/types/service-api.d.ts...')
266+
// try {
267+
// const fileData = await openapiTS(`${SESAME_APP_API_URL}/swagger/json`)
268+
// writeFileSync('.nuxt/types/service-api.d.ts', String(fileData))
269+
// console.log('[OpenapiTS] Generated .nuxt/types/service-api.d.ts !')
270+
// } catch (error) {
271+
// console.debug('[OpenapiTS] Error while generating .nuxt/types/service-api.d.ts', error)
272+
// }
273273
},
274274
},
275275
})

apps/web/package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,32 @@
2929
"@sentry/nuxt": "^10.25.0",
3030
"@sentry/profiling-node": "^10.26.0",
3131
"@vueuse/router": "^13.9.0",
32+
"@vueuse/core": "^10.7.2",
33+
"@vueuse/nuxt": "^10.7.2",
3234
"ajv": "^8.17.1",
3335
"ajv-errors": "^3.0.0",
3436
"ajv-i18n": "^4.2.0",
3537
"cookie": "^1.0.2",
38+
"dayjs-nuxt": "^2.1.11",
3639
"fast-password-entropy": "^1.1.1",
3740
"hibp": "^15.0.1",
3841
"moment": "^2.30.1",
3942
"monaco-editor": "^0.53.0",
43+
"nuxt": "^3.16.0",
44+
"nuxt-monaco-editor": "^1.4.0",
45+
"nuxt-quasar-ui": "^2.1.13",
4046
"openapi-fetch": "^0.14.0",
4147
"pinia": "^3.0.3",
4248
"qs": "^6.14.0",
4349
"quasar": "^2.18.2",
4450
"radash": "^12.1.1",
4551
"reconnecting-eventsource": "^1.6.4",
4652
"sass": "^1.92.1",
53+
"typescript": "^5.9.2",
54+
"vite-plugin-pug": "^0.4.1",
55+
"vue": "^3.4.14",
4756
"vue-eslint-parser": "^10.2.0",
57+
"vue-router": "^4.2.5",
4858
"yaml": "^2.8.1"
4959
},
5060
"devDependencies": {
@@ -54,20 +64,10 @@
5464
"@typescript-eslint/eslint-plugin": "^8.43.0",
5565
"@typescript-eslint/parser": "^8.43.0",
5666
"@vue/language-plugin-pug": "^1.8.27",
57-
"@vueuse/core": "^10.7.2",
58-
"@vueuse/nuxt": "^10.7.2",
59-
"dayjs-nuxt": "^2.1.11",
6067
"eslint": "^9.35.0",
6168
"memfs": "^4.39.0",
62-
"nuxt": "^3.16.0",
63-
"nuxt-monaco-editor": "^1.4.0",
64-
"nuxt-quasar-ui": "^2.1.13",
6569
"openapi-typescript": "^7.9.1",
6670
"prettier": "^3.6.2",
67-
"typescript": "^5.9.2",
68-
"vite-plugin-pug": "^0.4.1",
69-
"vue": "^3.4.14",
70-
"vue-router": "^4.2.5",
7171
"vue-tsc": "^1.8.27"
7272
},
7373
"resolutions": {

apps/web/start.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ dotenv.config()
88

99
function hashEnv() {
1010
const sum = createHash('sha256')
11-
// Ne hasher que les variables SESAME et npm_ qui impactent le build
11+
// Ne hasher que les variables SESAME et npm_ qui impactent le build + BUILD_VERSION
1212
const env = Object.fromEntries(Object.entries(process.env).filter(
13-
([key]) => key.startsWith('SESAME_') || key.startsWith('npm_')
13+
([key]) => key.startsWith('SESAME_') || key.startsWith('npm_') || key === 'BUILD_VERSION'
1414
))
15-
// console.log('env', env)
15+
console.log('env', env)
1616
sum.update(JSON.stringify(env))
1717
return sum.digest('hex')
1818
}
@@ -62,7 +62,7 @@ function buildNuxt() {
6262
}
6363
}
6464

65-
if (hashEnv() !== readHash()) {
65+
if (process.env.ALLOW_RUNTIME_BUILD === 'true' && hashEnv() !== readHash()) {
6666
consola.warn('Hash changed, rebuilding...')
6767
consola.info(`Hash: ${hashEnv()}, Previous: ${readHash()}`)
6868
await buildNuxt()

0 commit comments

Comments
 (0)