entrypoint, cmd, mount dir, work dir params
parent
9c34e1abac
commit
39ad2c81ad
File diff suppressed because one or more lines are too long
|
|
@ -30,18 +30,24 @@ Parameters:
|
|||
Type: Number
|
||||
Default: 512
|
||||
Description: How much memory in megabytes to give the container
|
||||
Prefix:
|
||||
Command:
|
||||
Type: String
|
||||
Default: test
|
||||
Default: 'ls'
|
||||
EntryPoint:
|
||||
Type: String
|
||||
Default: '/bin/sh,-c'
|
||||
WorkingDirectory:
|
||||
Type: String
|
||||
Default: '/efsdata/'
|
||||
Role:
|
||||
Type: String
|
||||
Default: ''
|
||||
Description: >-
|
||||
(Optional) An IAM role to give the service's containers if the code within
|
||||
needs to access other AWS resources like S3 buckets, DynamoDB tables, etc
|
||||
EFSMountPath:
|
||||
EFSMountDirectory:
|
||||
Type: String
|
||||
Default: /usr/share/nginx/html
|
||||
Default: /efsdata
|
||||
Mappings:
|
||||
SubnetConfig:
|
||||
VPC:
|
||||
|
|
@ -115,12 +121,21 @@ Resources:
|
|||
Cpu: !Ref ContainerCpu
|
||||
Memory: !Ref ContainerMemory
|
||||
Image: !Ref ImageUrl
|
||||
EntryPoint:
|
||||
Fn::Split:
|
||||
- ","
|
||||
- !Ref EntryPoint
|
||||
Command:
|
||||
Fn::Split:
|
||||
- ","
|
||||
- !Ref Commands
|
||||
WorkDir: !Ref WorkingDirectory
|
||||
Environment:
|
||||
- Name: ALLOW_EMPTY_PASSWORD
|
||||
Value: 'yes'
|
||||
MountPoints:
|
||||
- SourceVolume: efs-data
|
||||
ContainerPath: !Ref EFSMountPath
|
||||
ContainerPath: !Ref EFSMountDirectory
|
||||
ReadOnly: false
|
||||
LogConfiguration:
|
||||
LogDriver: awslogs
|
||||
|
|
|
|||
|
|
@ -12,7 +12,10 @@ class AWS {
|
|||
await this.run(
|
||||
buildParameters.awsStackName,
|
||||
'alpine/git',
|
||||
['git'],
|
||||
['clone', `https://github.com/${process.env.GITHUB_REPOSITORY}.git`, `repo`],
|
||||
'/efsdata',
|
||||
'/efsdata/',
|
||||
[
|
||||
{
|
||||
name: 'GITHUB_SHA',
|
||||
|
|
@ -23,12 +26,15 @@ class AWS {
|
|||
await this.run(
|
||||
buildParameters.awsStackName,
|
||||
baseImage.toString(),
|
||||
['bin/bash', '-c', 'echo "test"'],
|
||||
['bin/bash', '-c'],
|
||||
['echo', '"test"'],
|
||||
'/efsdata',
|
||||
'/efsdata/',
|
||||
[],
|
||||
);
|
||||
}
|
||||
|
||||
static async run(stackName, image, commands, environment) {
|
||||
static async run(stackName, image, entrypoint, commands, mountdir, workingdir, environment) {
|
||||
const ECS = new SDK.ECS();
|
||||
const CF = new SDK.CloudFormation();
|
||||
|
||||
|
|
@ -49,6 +55,22 @@ class AWS {
|
|||
ParameterKey: 'ServiceName',
|
||||
ParameterValue: taskDefStackName,
|
||||
},
|
||||
{
|
||||
ParameterKey: 'Command',
|
||||
ParameterValue: commands.join(','),
|
||||
},
|
||||
{
|
||||
ParameterKey: 'EntryPoint',
|
||||
ParameterValue: entrypoint.join(','),
|
||||
},
|
||||
{
|
||||
ParameterKey: 'WorkingDirectory',
|
||||
ParameterValue: workingdir,
|
||||
},
|
||||
{
|
||||
ParameterKey: 'EFSMountDirectory',
|
||||
ParameterValue: mountdir,
|
||||
},
|
||||
],
|
||||
}).promise();
|
||||
await CF.waitFor('stackCreateComplete', { StackName: taskDefStackName }).promise();
|
||||
|
|
@ -68,16 +90,15 @@ class AWS {
|
|||
(x) => x.LogicalResourceId === 'TaskDefinition',
|
||||
).PhysicalResourceId,
|
||||
platformVersion: '1.4.0',
|
||||
launchType: 'FARGATE',
|
||||
overrides: {
|
||||
containerOverrides: [
|
||||
{
|
||||
name: taskDefStackName,
|
||||
environment,
|
||||
command: commands,
|
||||
},
|
||||
],
|
||||
},
|
||||
launchType: 'FARGATE',
|
||||
networkConfiguration: {
|
||||
awsvpcConfiguration: {
|
||||
subnets: [
|
||||
|
|
|
|||
Loading…
Reference in New Issue