@payfit/nx-core 5.19.0-ephemeral-dockerimage-tini.0 → 5.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -14
- package/dist/src/migrations/5.19.0/20260212-docker-tini.d.ts +2 -0
- package/dist/src/migrations/5.19.0/20260212-docker-tini.js +54 -0
- package/dist/src/migrations/5.19.0/20260212-docker-tini.js.map +1 -0
- package/dist/src/migrations/5.19.0/Dockerfile.without-tini +38 -0
- package/dist/src/migrations/README.md +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -172,18 +172,6 @@ The inference of the `nx-release-publish` target is handled through Nx's plugin
|
|
|
172
172
|
|
|
173
173
|
---
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
## Development
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
npx nx run-many -t build
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
2. Trigger a new release using the local plugin version:
|
|
184
|
-
|
|
185
|
-
```bash
|
|
186
|
-
npx nx run @payfit/core-platform:release --dry-run
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
Make sure you pushed a change to your branch to actually trigger a release, otherwise it will say something like `No project to publish`
|
|
177
|
+
See [AGENTS.md](./AGENTS.md) for build, test, and development instructions.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const logger_1 = require("../../utils/common/logger");
|
|
7
|
+
const path = require("node:path");
|
|
8
|
+
function update(tree) {
|
|
9
|
+
logger_1.consola.start('Updating Dockerfiles to add tini...');
|
|
10
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
11
|
+
for (const [_, projectConfig] of projects.entries()) {
|
|
12
|
+
const dockerfilePath = path.join(projectConfig.root, 'Dockerfile');
|
|
13
|
+
if (tree.exists(dockerfilePath)) {
|
|
14
|
+
const dockerFileContent = tree.read(dockerfilePath, 'utf-8');
|
|
15
|
+
if (!dockerFileContent) {
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
// Skip if tini is already configured
|
|
19
|
+
if (dockerFileContent.includes('tini')) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const lines = dockerFileContent.split('\n');
|
|
23
|
+
const modifiedLines = [];
|
|
24
|
+
let lastFromIndex = -1;
|
|
25
|
+
let lastCmdIndex = -1;
|
|
26
|
+
// Find the last FROM and last CMD
|
|
27
|
+
for (let i = 0; i < lines.length; i++) {
|
|
28
|
+
if (lines[i].trim().startsWith('FROM ')) {
|
|
29
|
+
lastFromIndex = i;
|
|
30
|
+
}
|
|
31
|
+
if (lines[i].trim().startsWith('CMD ')) {
|
|
32
|
+
lastCmdIndex = i;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Build the modified content
|
|
36
|
+
for (let i = 0; i < lines.length; i++) {
|
|
37
|
+
modifiedLines.push(lines[i]);
|
|
38
|
+
// Add RUN apk add after the last FROM
|
|
39
|
+
if (i === lastFromIndex) {
|
|
40
|
+
modifiedLines.push('');
|
|
41
|
+
modifiedLines.push('RUN apk add --no-cache tini\n');
|
|
42
|
+
}
|
|
43
|
+
// Add ENTRYPOINT before the last CMD
|
|
44
|
+
if (i === lastCmdIndex - 1 && lastCmdIndex !== -1) {
|
|
45
|
+
modifiedLines.push('');
|
|
46
|
+
modifiedLines.push('ENTRYPOINT ["/sbin/tini", "--"]\n');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
tree.write(dockerfilePath, modifiedLines.join('\n'));
|
|
50
|
+
logger_1.consola.success(`Dockerfile for ${projectConfig.name} updated successfully`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=20260212-docker-tini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260212-docker-tini.js","sourceRoot":"","sources":["../../../../src/migrations/5.19.0/20260212-docker-tini.ts"],"names":[],"mappings":";;AAOA,yBA0DC;AAjED,sDAAsD;AACtD,uCAA8C;AAE9C,sDAAmD;AAEnD,kCAAkC;AAElC,SAAwB,MAAM,CAAC,IAAU;IACvC,gBAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAA;IAEpD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAA;IAElC,KAAK,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC;QACpD,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;QAElE,IAAI,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;YAChC,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAA;YAE5D,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACvB,SAAQ;YACV,CAAC;YAED,qCAAqC;YACrC,IAAI,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBACvC,SAAQ;YACV,CAAC;YAED,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;YAC3C,MAAM,aAAa,GAAa,EAAE,CAAA;YAClC,IAAI,aAAa,GAAG,CAAC,CAAC,CAAA;YACtB,IAAI,YAAY,GAAG,CAAC,CAAC,CAAA;YAErB,kCAAkC;YAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,UAAU,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
|
+
# Copy files for dependencies install
|
|
11
|
+
COPY .yarnrc.yml .
|
|
12
|
+
COPY .yarn .yarn
|
|
13
|
+
COPY dist/apps/${APPNAME}/package.json \
|
|
14
|
+
dist/apps/${APPNAME}/yarn.lock \
|
|
15
|
+
.
|
|
16
|
+
|
|
17
|
+
RUN --mount=type=cache,target=/usr/src/app/.yarn/cache \
|
|
18
|
+
--mount=type=secret,id=NPM_TOKEN,env=NPM_TOKEN \
|
|
19
|
+
yarn workspaces focus --production
|
|
20
|
+
|
|
21
|
+
FROM base AS production
|
|
22
|
+
|
|
23
|
+
WORKDIR /usr/src/app
|
|
24
|
+
|
|
25
|
+
ENV NODE_OPTIONS="--enable-source-maps --no-deprecation"
|
|
26
|
+
ENV NODE_ENV=production
|
|
27
|
+
|
|
28
|
+
ARG DD_GIT_REPOSITORY_URL
|
|
29
|
+
ARG DD_GIT_COMMIT_SHA
|
|
30
|
+
ENV DD_GIT_REPOSITORY_URL=${DD_GIT_REPOSITORY_URL}
|
|
31
|
+
ENV DD_GIT_COMMIT_SHA=${DD_GIT_COMMIT_SHA}
|
|
32
|
+
|
|
33
|
+
COPY --from=builder /usr/src/app/package.json .
|
|
34
|
+
COPY --from=builder /usr/src/app/node_modules node_modules
|
|
35
|
+
COPY dist/apps/${APPNAME}/main.js .
|
|
36
|
+
COPY dist/apps/${APPNAME}/api-documentation ./api-documentation
|
|
37
|
+
|
|
38
|
+
CMD ["node", "-r", "dotenv/config", "main"]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
### Create the migration
|
|
4
4
|
|
|
5
|
-
`npx nx generate @nx/plugin:migration packages/nx-core/src/migrations/<migration-name>`
|
|
5
|
+
`npx nx generate @nx/plugin:migration packages/nx-core/src/migrations/<sermver>/<date>-<migration-name>`
|
|
6
6
|
|
|
7
7
|
Nx will ask interactively some information, mainly the targeted version to link it up with the migration.
|
|
8
8
|
|