File tree Expand file tree Collapse file tree 11 files changed +559
-2
lines changed Expand file tree Collapse file tree 11 files changed +559
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " leq-devcontainer" ,
3
- "dockerComposeFile" : " docker-compose.yml " ,
3
+ "dockerComposeFile" : " docker-compose.yaml " ,
4
4
"service" : " app" ,
5
5
"workspaceFolder" : " /workspaces/${localWorkspaceFolderBasename}"
6
6
}
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ name : Publish
2
+
3
+ on :
4
+ pull_request :
5
+ types :
6
+ - closed
7
+ branches :
8
+ - main
9
+
10
+ jobs :
11
+ publish :
12
+ if : github.event.pull_request.merged == true && github.head_ref == 'changeset-release/main'
13
+ name : Publish
14
+ runs-on : ubuntu-latest
15
+ steps :
16
+ - name : Checkout
17
+ uses : actions/checkout@v4
18
+ with :
19
+ # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
20
+ fetch-depth : 0
21
+
22
+ - name : Setup pnpm
23
+ uses : pnpm/action-setup@v3
24
+
25
+ - name : Setup Node
26
+ uses : actions/setup-node@v4
27
+ with :
28
+ node-version : 20
29
+ registry-url : https://registry.npmjs.org
30
+ cache : pnpm
31
+
32
+ - name : Install dependencies
33
+ run : pnpm install
34
+
35
+ - name : Publish
36
+ uses : changesets/action@v1
37
+ id : changesets
38
+ with :
39
+ version : pnpm version
40
+ publish : pnpm tag
41
+ env :
42
+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
43
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
44
+ outputs :
45
+ ref : ${{ github.ref }}
46
+ published : ${{ steps.changesets.outputs.published }}
47
+
48
+ deploy-to-registries :
49
+ name : Deploy to registries
50
+ uses : ./.github/workflows/cd-registries.yaml
51
+ needs : publish
52
+ with :
53
+ ref : ${{ needs.publish.outputs.ref }}
54
+ secrets : inherit
55
+ if : ${{ needs.publish.outputs.published }}
Original file line number Diff line number Diff line change
1
+ name : Deploy to registries
2
+
3
+ on :
4
+ workflow_call :
5
+ inputs :
6
+ ref :
7
+ required : true
8
+ type : string
9
+ workflow_dispatch :
10
+
11
+ env :
12
+ # Use docker.io for Docker Hub if empty
13
+ REGISTRY : ghcr.io
14
+ # github.repository as <account>/<repo>
15
+ IMAGE_NAME : ${{ github.repository }}
16
+
17
+ jobs :
18
+ build-and-deploy :
19
+ name : Build and deploy
20
+ runs-on : ubuntu-latest
21
+ steps :
22
+ - name : Checkout repo
23
+ uses : actions/checkout@v4
24
+ with :
25
+ ref : ${{ inputs.ref }}
26
+ fetch-depth : 0
27
+
28
+ - name : Set up Docker Buildx
29
+ uses : docker/setup-buildx-action@v3
30
+
31
+ - name : Log into registry ${{ env.REGISTRY }}
32
+ uses : docker/login-action@v3
33
+ with :
34
+ registry : ${{ env.REGISTRY }}
35
+ username : ${{ github.actor }}
36
+ password : ${{ secrets.GITHUB_TOKEN }}
37
+
38
+
39
+ - name : Setup pnpm
40
+ uses : pnpm/action-setup@v3
41
+
42
+ - name : Setup Node
43
+ uses : actions/setup-node@v4
44
+ with :
45
+ node-version : 20
46
+ registry-url : https://registry.npmjs.org
47
+ cache : pnpm
48
+
49
+ - name : Install dependencies
50
+ run : pnpm install
51
+
52
+ - name : Derive appropriate SHAs for base and head for `nx affected` commands
53
+ uses : nrwl/nx-set-shas@v3
54
+
55
+ - name : ' Build images'
56
+ run : INPUT_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} npx nx affected --base=$NX_BASE --head=$NX_HEAD --target=container --parallel=2
57
+
Original file line number Diff line number Diff line change
1
+ # Install dependencies only when needed
2
+ FROM docker.io/node:lts-alpine AS deps
3
+ # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
4
+ RUN apk add --no-cache libc6-compat
5
+ WORKDIR /usr/src/app
6
+ COPY dist/apps/backend/package*.json ./
7
+ RUN npm install --omit=dev
8
+
9
+ # Production image, copy all the files and run nest
10
+ FROM docker.io/node:lts-alpine AS runner
11
+ RUN apk add --no-cache dumb-init
12
+ ENV NODE_ENV=production
13
+ ENV PORT=3000
14
+ WORKDIR /usr/src/app
15
+ COPY --from=deps /usr/src/app/node_modules ./node_modules
16
+ COPY --from=deps /usr/src/app/package.json ./package.json
17
+ COPY dist/apps/backend .
18
+ RUN chown -R node:node .
19
+ USER node
20
+ EXPOSE 3000
21
+ CMD ["dumb-init" , "node" , "main.js" ]
Original file line number Diff line number Diff line change 66
66
],
67
67
"coverageDirectory" : " ../coverage" ,
68
68
"testEnvironment" : " node"
69
+ },
70
+ "nx" : {
71
+ "targets" : {
72
+ "container" : {
73
+ "executor" : " @nx-tools/nx-container:build" ,
74
+ "dependsOn" : [
75
+ " build"
76
+ ],
77
+ "options" : {
78
+ "engine" : " docker" ,
79
+ "metadata" : {
80
+ "images" : [
81
+ " backend"
82
+ ],
83
+ "load" : true ,
84
+ "tags" : [
85
+ " type=schedule" ,
86
+ " type=ref,event=branch" ,
87
+ " type=ref,event=tag" ,
88
+ " type=ref,event=pr" ,
89
+ " type=sha,prefix=sha-"
90
+ ]
91
+ }
92
+ }
93
+ }
94
+ }
69
95
}
70
96
}
Original file line number Diff line number Diff line change
1
+ FROM docker.io/nginx:stable-alpine
2
+ COPY dist/apps/frontend/* /usr/share/nginx/html/
3
+ EXPOSE 80
4
+ CMD ["nginx" , "-g" , "daemon off;" ]
Original file line number Diff line number Diff line change 25
25
"typescript" : " ^5.5.3" ,
26
26
"typescript-eslint" : " ^8.0.1" ,
27
27
"vite" : " ^5.4.1"
28
+ },
29
+ "nx" : {
30
+ "targets" : {
31
+ "container" : {
32
+ "executor" : " @nx-tools/nx-container:build" ,
33
+ "dependsOn" : [
34
+ " build"
35
+ ],
36
+ "options" : {
37
+ "engine" : " docker" ,
38
+ "metadata" : {
39
+ "images" : [
40
+ " frontend"
41
+ ],
42
+ "load" : true ,
43
+ "tags" : [
44
+ " type=schedule" ,
45
+ " type=ref,event=branch" ,
46
+ " type=ref,event=tag" ,
47
+ " type=ref,event=pr" ,
48
+ " type=sha,prefix=sha-"
49
+ ]
50
+ }
51
+ }
52
+ }
53
+ }
28
54
}
29
55
}
Original file line number Diff line number Diff line change 4
4
"targetDefaults" : {
5
5
"build" : {
6
6
"dependsOn" : [" ^build" ],
7
- "cache" : true
7
+ "cache" : true ,
8
+ "outputs" : [" {workspaceRoot}/dist/{projectName}" ]
8
9
},
9
10
"dev" : {
10
11
"dependsOn" : [" ^build" ]
Original file line number Diff line number Diff line change 17
17
"devDependencies" : {
18
18
"@changesets/cli" : " ^2.27.8" ,
19
19
"@nestjs/cli" : " ^10.0.0" ,
20
+ "@nx-tools/container-metadata" : " ^6.0.2" ,
21
+ "@nx-tools/nx-container" : " ^6.0.2" ,
20
22
"nx" : " 19.7.3"
21
23
},
22
24
"engines" : {
You can’t perform that action at this time.
0 commit comments