Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): add image flag to svc/job init #1473

Merged
merged 7 commits into from
Oct 9, 2020

Conversation

iamhopaul123
Copy link
Contributor

@iamhopaul123 iamhopaul123 commented Oct 6, 2020

Add image flag to svc init and job init so that users can opt-in using existing docker image instead of building from local Dockerfile, and write to the manifest.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@iamhopaul123 iamhopaul123 requested a review from a team as a code owner October 6, 2020 22:50
@iamhopaul123 iamhopaul123 requested a review from kohidave October 6, 2020 22:50
@iamhopaul123
Copy link
Contributor Author

iamhopaul123 commented Oct 6, 2020

Service

$ copilot svc init -i 1234567890.dkr.ecr.us-west-2.amazonaws.com/my-app/my-svc:94e505c

# Your service name will be used in naming your resources like log groups, ECS services, etc.
name: my-app
# The "architecture" of the service you're running.
type: Load Balanced Web Service

image:
  # The Docker image used for your service. Images in the Docker Hub registry are available by default. Other repositories are specified with either repository-url/image:tag or repository-url/image@digest.
  location: 1234567890.dkr.ecr.us-west-2.amazonaws.com/my-app/my-svc:94e505c
  # Port exposed through your container to route traffic to it.
  port: 5000

http:
  # Requests to this path will be forwarded to your service. 
  # To match all requests you can use the "/" path. 
  path: '/'
  # You can specify a custom health check path. The default is "/"
  # healthcheck: '/'
  # You can enable sticky sessions.
  # stickiness: true

# Number of CPU units for the task.
cpu: 256
# Amount of memory in MiB used by the task.
memory: 512
# Number of tasks that should be running in your service.
count: 1

Job

$ copilot job init -i 1234567890.dkr.ecr.us-west-2.amazonaws.com/my-app/my-svc:94e505c

# Your job name will be used in naming your resources like log groups, ECS Tasks, etc.
name: my-job

# The "architecture" of the job you're running.
type: Scheduled Job

image:
  # The Docker image used for your service.
  location: 1234567890.dkr.ecr.us-west-2.amazonaws.com/my-app/my-svc:94e505c

# Number of CPU units for the task.
cpu: 256
# Amount of memory in MiB used by the task.
memory: 512

# The trigger for your job. You can specify a cron schedule or keyword (@weekly) or a rate (2h, 1h30m, 15m)
schedule: "@hourly"

Both service and job are deployed successfully.

@iamhopaul123 iamhopaul123 changed the title feat(cli): add image flag to svc init feat(cli): add image flag to svc/job init Oct 7, 2020
@efekarakus efekarakus removed the request for review from kohidave October 7, 2020 17:43
Comment on lines +333 to +334
func stringP(s string) *string {
if s == "" {
Copy link
Contributor

@efekarakus efekarakus Oct 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm is this necessary? Does {{if .ImageConfig.Location}} evaluate to true if the pointer points to an empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah it is necessary. otherwise i tried and the result is like this:

image:
  # Docker build arguments. You can specify additional overrides here. Supported: dockerfile, context, args.
  build: Dockerfile
  # The Docker image used for your service.
  location: 
  # Port exposed through your container to route traffic to it.
  port: 5000

@efekarakus efekarakus added the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Oct 7, 2020
@iamhopaul123 iamhopaul123 removed the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Oct 8, 2020
Copy link
Contributor

@huanjani huanjani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty cool!

@mergify mergify bot merged commit 08145f8 into aws:mainline Oct 9, 2020
thrau pushed a commit to localstack/copilot-cli-local that referenced this pull request Dec 9, 2022
<!-- Provide summary of changes -->
Add image flag to `svc init` and `job init` so that users can opt-in using existing docker image instead of building from local Dockerfile, and write to the manifest.
<!-- Issue number, if available. E.g. "Fixes aws#31", "Addresses aws#42, 77" -->

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants