{"id":16314490,"url":"https://github.com/ntno/docker-config-example","last_synced_at":"2025-07-01T12:04:43.343Z","repository":{"id":133095530,"uuid":"206484489","full_name":"ntno/docker-config-example","owner":"ntno","description":null,"archived":false,"fork":false,"pushed_at":"2019-09-06T05:22:55.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-27T23:13:52.864Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ntno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-05T05:47:49.000Z","updated_at":"2019-09-06T05:22:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4f66bc5-5f5e-4903-86d2-794b0f196340","html_url":"https://github.com/ntno/docker-config-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ntno/docker-config-example","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntno%2Fdocker-config-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntno%2Fdocker-config-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntno%2Fdocker-config-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntno%2Fdocker-config-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ntno","download_url":"https://codeload.github.com/ntno/docker-config-example/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntno%2Fdocker-config-example/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262959560,"owners_count":23391057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T21:54:03.839Z","updated_at":"2025-07-01T12:04:43.317Z","avatar_url":"https://github.com/ntno.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# docker-config-example\n\n## Step 1) Build\n### development image \n`docker build hello-verity -t hello-verity --build-arg ENVIRON=dev`  \nor  \n`export ENVIRON=dev \u0026\u0026 docker build hello-verity -t hello-verity --build-arg ENVIRON=$ENVIRON`  \n\n\n### prod image\n`docker build hello-verity -t hello-verity --build-arg ENVIRON=prod`  \nor  \n`export ENVIRON=prod \u0026\u0026 docker build hello-verity -t hello-verity --build-arg ENVIRON=$ENVIRON`  \n\n*Note: image will default to the dev configuration if no build argument is specified*\n\n## Step 2) Deploy\n### 2.a - prerequisites\n* aws account with existing elastic container registry repository \n* awscli installed\n* awscli configured with user who has read/write access to the repository\n\n### 2.b - tag the newly built image\nuse the following command to tag your new image (built in the previous step) where\n\n* IMAGE_ID is the docker id for the image,\n* AWS_ACCOUNT_ID is your aws account id number,\n* AWS_REGION is your default aws region,\n* ECR_REPO is the name of the elastic container registry repository in your account, and\n* LABEL is a custom label\n\n`docker tag [IMAGE_ID] [AWS_ACCOUNT_ID].dkr.ecr.[AWS_REGION].amazonaws.com/[ECR_REPO]:[LABEL]`\n\nif you are unsure of any of these inputs you can use the following commands to help find out what the correct values are: \n\n* IMAGE_ID\n  * `docker image ls`\n* AWS_ACCOUNT_ID\n  * `$(aws sts get-caller-identity --output text --query 'Account')`\n* AWS_REGION\n  * `$(aws configure get region.amazonaws.com)`\n* ECR_REPO\n  * check the aws console or refer to the code which deployed the repository \n* LABEL\n  * you can choose this one\n\n*Note:* keep the dollar sign and the parentheses in the above commands\n\n\nexample:  \n`docker tag 56b6386818ba 987654321.dkr.ecr.us-east-2.amazonaws.com/hello-world:verity`\n\n\n### 2.c - push the image \nuse the following command to push the image to your elastic container registry repository\n\n`docker push [AWS_ACCOUNT_ID].dkr.ecr.[AWS_REGION].amazonaws.com/[ECR_REPO]:[LABEL]`\n\nexample:  \n`docker push 987654321.dkr.ecr.us-east-2.amazonaws.com/hello-world:verity`\n\n\n## Step 3) Run image as a container\n### 3.a - run image locally with port 80 open\n\n`docker run -p 80:80 -d 987654321.dkr.ecr.us-east-2.amazonaws.com/hello-world:verity`\n\n### 3.b - run image in EC2 or ECS and configure cloudwatch logging\n*Prerequisite: you must already have a log group provisioned and an ec2 instance with the proper permissions*\n\n`docker pull 987654321.dkr.ecr.us-east-2.amazonaws.com/hello-world:verity` \n\n`docker run --log-driver=awslogs --log-opt awslogs-group=[YOUR_LOG_GROUP_NAME_HERE] -p 80:80 -d  987654321.dkr.ecr.us-east-2.amazonaws.com/hello-world:verity`\n\n\n## Future Enhancements\n* continue to research how to swap out environment variables in an easy / robust way\n  * started looking into the utility \"gettext-base\" which looked promising but there is probably a better way to do it using docker or docker-compose.  I will need to read the docs further\n* automated infrastructure deployment of ec2 instance or ecs cluster\n  * see work in progress [here](https://github.com/ntno/ntno-challenge/blob/master/infrastructure/cloudformation/cft/deploy-hello-world-app.yml)\n* automated build/deploy pipeline on aws codepipeline\n  * see work in progress [here](https://github.com/ntno/ntno-challenge/blob/master/infrastructure/cloudformation/cft/pipeline.yml)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntno%2Fdocker-config-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntno%2Fdocker-config-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntno%2Fdocker-config-example/lists"}