Skip to content

DevOps: Update VA AWS ECR image

Emmanuel Nwakire edited this page Jan 15, 2025 · 9 revisions

Update VA AWS ECR image

Purpose

This guide is helpful when trying to make any updates to our base AWS ECR image (e.g. updating ruby version).

Prerequisites

  • Access to VAEC dev server
  • SSH/Connect to the dev server via Session Manager
  • Kindly note that the Dev Server serves as both the Build server and Deployment server.
  • Sudo su ec2-user
  • cd and ls, you should see the Dockerfile for building the new Ruby Image with the application dependencies
  • Follow the **VAEC DEV server changes** below to build , login and push the image to AWS ECR.
  • AWS ECR is the official Docker image repository for this project.
  • Once you have built, tag and push the image to ECR, follow steps here in building the application with the new ruby images

VAEC DEV server changes

  • Build and tag the image on the DEV server.
sudo docker build -t [aws_account_id].dkr.ecr.us-gov-west-1.amazonaws.com/[repository]:[tag_name] . 

e.g.

sudo docker build -t #############.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:ruby-2.7.8 . 
  • Before pushing, log in to docker LOG in to the AWS ECR via docker so you are able to push ON dev
sudo docker login -u AWS -p $(sudo /usr/local/bin/aws ecr get-login-password --region us-gov-west-1) [aws_account_id].dkr.ecr.[region].amazonaws.com 

ON stg, prod

sudo docker login -u AWS -p $(sudo aws ecr get-login-password --region us-gov-west-1) [aws_account_id].dkr.ecr.[region].amazonaws.com 
  • push to AWS ECR
sudo docker push [aws_account_id].dkr.ecr.[region].amazonaws.com/[repository name]:[tag name] 

e.g.

sudo docker push #############.dkr.ecr.us-gov-west-1.amazonaws.com/diffusion-marketplace:ruby-2.7.8

Local environment

Note: There are ways to do this without having Docker locally but this is the ideal method

Local changes to Dockerfile

  • cd into the Dockerfile repo
  • cd until you get to the directory with the Dockerfile that has all your changes
  • Build and tag the docker image
docker build -t [ORG]/[REPO]:[TAG_NAME] .

e.g.

docker build -t agilesix/ruby:2.7.8.
  • Push the image to DockerHub
docker push [ORGANIZATION]/[REPO]:[TAG_NAME]

e.g.

docker push agilesix/ruby:2.7.8
Clone this wiki locally