Skip to content

Instantly share code, notes, and snippets.

@swarkentin
Last active December 7, 2018 17:39
Show Gist options
  • Save swarkentin/84e9eb904237ae63a18cb363b6e56ca9 to your computer and use it in GitHub Desktop.
Save swarkentin/84e9eb904237ae63a18cb363b6e56ca9 to your computer and use it in GitHub Desktop.
my-build:
build:
image: 1234.dkr.ecr.us-west-2.amazonaws.com/foo
dockerfile: Dockerfile
awsdockercfg:
image: codeship/aws-ecr-dockercfg-generator
add_docker: true
encrypted_env_file: env.ecr.encrypted
environment:
- AWS_REGION=us-west-2
awsdeployment:
image: codeship/aws-deployment
encrypted_env_file: env.dev.encrypted
environment:
- AWS_DEFAULT_REGION=us-west-2
# Tag the master branch with 'latest'
- name: Push_Master_Image_Tag_To_ECR
service: my-build
tag: master
type: push
registry: https://1234.dkr.ecr.us-west-2.amazonaws.com
image_name: 1234.dkr.ecr.us-west-2.amazonaws.com/foo
image_tag: latest
dockercfg_service: awsdockercfg
# This forces ECS to use the new image, built from master
- name: Redeploy_Develop_Environment
service: awsdeployment
tag: master
command: aws ecs update-service --cluster $ECS-CLUSTER-NAME --service $ECS-SERVICE-NAME --force-new-deployment
FROM python:3.6.7-slim-stretch
WORKDIR /opt/app
# Resolve dependencies
COPY requirements.txt ./
RUN pip3 install --no-cache -r requirements.txt
# Copy the rest of the app
COPY . /opt/app
# Clean up to save some space
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Start the application
ENTRYPOINT ["python3", "-u", "/opt/app/main.py"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment