Skip to content

Instantly share code, notes, and snippets.

@hmanzur
Last active January 31, 2022 15:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmanzur/f4150c32330cdebe877e159d549c1be2 to your computer and use it in GitHub Desktop.
Save hmanzur/f4150c32330cdebe877e159d549c1be2 to your computer and use it in GitHub Desktop.
Beanstalk Environments to Docker container build in .env file
Usefull extensions and Dockerfiles to setup Elastic Beanstalk app
{
"AWSEBDockerrunVersion": "1",
"Logging": "/tmp/app",
"Image": {
"Update": "true"
}
}
files:
"/opt/elasticbeanstalk/hooks/appdeploy/pre/02_mix_environment.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
EB_APP_DEPLOY_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir)
# Example with MY_ENV
# MY_ENV=$(/opt/elasticbeanstalk/bin/get-config environment -k MY_ENV)
# echo "export DB_USER=${MY_ENV}" >> ${EB_APP_DEPLOY_DIR}/.env
# Add here yout environments
# Example in Dockerfile
FROM ubuntu:latest
# Add commands here
# Set env
RUN /bin/bash -c "source .env"
# Set CMD or ENTRYPOINT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment