Skip to content

Instantly share code, notes, and snippets.

@aalonzolu
Created August 4, 2020 15:21
Show Gist options
  • Save aalonzolu/e5098cb7d2858018ce964b1a796bc599 to your computer and use it in GitHub Desktop.
Save aalonzolu/e5098cb7d2858018ce964b1a796bc599 to your computer and use it in GitHub Desktop.
Deploy app from gitlab to AWS Beanstalk
stages:
- build
- deploy
build:
image: aalonzolu/nodeawsdeploy
only:
- master
stage: build
allow_failure: false
script:
- zip -r _app.zip . -x *.git*
artifacts:
paths:
- _app.zip
deploy:
image: aalonzolu/nodeawsdeploy
only:
- master
stage: deploy
script:
- aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID
- aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY
- aws configure set region $AWS_REGION
- aws s3 cp _app.zip s3://$AWS_APP_S3/$AWS_APP_NAME-$CI_PIPELINE_ID.zip
- aws elasticbeanstalk create-application-version --application-name $AWS_APP_NAME --version-label $AWS_APP_NAME-$CI_PIPELINE_ID --source-bundle S3Bucket=$AWS_APP_S3,S3Key=$AWS_APP_NAME-$CI_PIPELINE_ID.zip
- aws elasticbeanstalk update-environment --application-name $AWS_APP_NAME --environment-name $AWS_ENV_NAME --version-label $AWS_APP_NAME-$CI_PIPELINE_ID
dependencies:
- build
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://localhost:2375
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment