-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
2,597 additions
and
2,546 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const DEFAULT_ENGINE = 'docker'; | ||
|
||
export const DEFAULT_TEMPLATE = 'empty'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../react-angular-spa/Dockerfile__template__ → ...s/init/files/nginx/Dockerfile__template__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM docker.io/nginx:stable-alpine | ||
COPY dist/apps/<%= projectName %>/* /usr/share/nginx/html/ | ||
COPY dist/apps/<%= projectName %>/* /usr/share/nginx/html/ | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |
57 changes: 57 additions & 0 deletions
57
packages/nx-container/src/generators/init/generator.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { Tree, addProjectConfiguration, readProjectConfiguration } from '@nx/devkit'; | ||
import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing'; | ||
import { initGenerator } from './generator'; | ||
import { InitGeneratorSchema } from './schema'; | ||
|
||
describe('init generator', () => { | ||
let tree: Tree; | ||
|
||
beforeEach(() => { | ||
tree = createTreeWithEmptyWorkspace(); | ||
}); | ||
|
||
test.each([ | ||
[1, 'myapp', 'docker', undefined, 'docker', undefined], | ||
[2, 'myapp', 'docker', 'nest', 'docker', 'CMD ["dumb-init", "node", "main.js"]'], | ||
[3, 'myapp', 'docker', 'next', 'docker', 'ENV NEXT_TELEMETRY_DISABLED 1'], | ||
[4, 'myapp', 'docker', 'nginx', 'docker', 'FROM docker.io/nginx:stable-alpine'], | ||
[5, 'myapp', 'podman', undefined, 'podman', undefined], | ||
[6, 'myapp', 'podman', 'nest', 'podman', 'CMD ["dumb-init", "node", "main.js"]'], | ||
[7, 'myapp', 'podman', 'next', 'podman', 'ENV NEXT_TELEMETRY_DISABLED 1'], | ||
[8, 'myapp', 'podman', 'nginx', 'podman', 'FROM docker.io/nginx:stable-alpine'], | ||
[9, 'myapp', 'kaniko', undefined, 'kaniko', undefined], | ||
[10, 'myapp', 'kaniko', 'nest', 'kaniko', 'CMD ["dumb-init", "node", "main.js"]'], | ||
[11, 'myapp', 'kaniko', 'next', 'kaniko', 'ENV NEXT_TELEMETRY_DISABLED 1'], | ||
[12, 'myapp', 'kaniko', 'nginx', 'kaniko', 'FROM docker.io/nginx:stable-alpine'], | ||
])( | ||
'%d - given projectName=%s, engine=%s and template=%s - should generate configuration for %s executor and proper dockerfile', | ||
async (_, projectName, engine: any, template: any, executor, text) => { | ||
const options: InitGeneratorSchema = { project: projectName, engine, template }; | ||
|
||
addProjectConfiguration(tree, projectName, { root: `apps/${projectName}` }); | ||
|
||
await initGenerator(tree, options); | ||
|
||
const project = readProjectConfiguration(tree, projectName); | ||
expect(tree.exists('./apps/myapp/Dockerfile')).toBeTruthy(); | ||
|
||
const contents = tree.read('./apps/myapp/Dockerfile', 'utf-8'); | ||
|
||
if (text) { | ||
expect(contents.includes(text)).toBeTruthy(); | ||
expect(contents.includes(`COPY dist/apps/${projectName}/`)).toBeTruthy(); | ||
} else { | ||
expect(contents).toBe(''); | ||
} | ||
|
||
expect(project.targets).toMatchObject({ | ||
container: { | ||
executor: `@nx-tools/nx-container:build`, | ||
options: { | ||
engine: executor, | ||
}, | ||
}, | ||
}); | ||
} | ||
); | ||
}); |
Oops, something went wrong.