Steps to Simple Docker File to create centos 7 install node, maven
$ vi Dockerfile
FROM centos:7
RUN yum -y update ; yum -y install java-1.8.0-openjdk-devel wget which
RUN yum install -y gcc gcc-c++ \
libtool libtool-ltdl \
make cmake \
git \
pkgconfig \
sudo \
automake autoconf \
yum-utils rpm-build && \
yum clean all
RUN curl -sL https://rpm.nodesource.com/setup_10.x | bash -
RUN yum -y install nodejs
RUN npm install -g @angular/cli
RUN wget https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
RUN tar xvf apache-maven-3.6.3-bin.tar.gz -C /usr/lib/
RUN echo 'M2_HOME="/usr/lib/apache-maven-3.6.3"' >> /etc/profile
RUN echo 'export M2_HOME' >> /etc/profile
RUN echo 'M2="$M2_HOME/bin"' >> /etc/profile
RUN echo 'MAVEN_OPTS="-Xms512m -Xmx1024m"' >> /etc/profile
RUN echo 'export M2 MAVEN_OPTS' >> /etc/profile
RUN echo 'PATH=$M2:$PATH' >> /etc/profile
RUN echo 'export PATH' >> /etc/profile
RUN echo "source /etc/profile" >> /root/.bashrc
ENV FLAVOR=rpmbuild OS=centos DIST=el7
CMD ["/bin/bash"]
Build docker image and push to AWS. Make sure docker and AWS CLI installed
1. Create repository in AWS ECS.
2. In AWS select repository (view push commands) to see the commands
Retrieve an authentication token and authenticate your Docker client to your registry.
aws ecr get-login-password --region us-west-2 --profile <profile> | docker login --username AWS --password-stdin gubendran.dkr.ecr.us-west-2.amazonaws.com
Note: If you receive an error using the AWS CLI, make sure that you have the latest version of the AWS CLI and Docker installed.
Build your Docker image using the following command. For information on building a Docker file from scratch see the instructions here . You can skip this step if your image is already built:
docker build -t test_build:2.5.0 .
After the build completes, tag your image so you can push the image to this repository:
docker tag test_build:2.5.0 gubendran.dkr.ecr.us-west-2.amazonaws.com/test_build:2.5.0
Run the following command to push this image to your newly created AWS repository:
docker push gubendran.dkr.ecr.us-west-2.amazonaws.com/test_build:2.5.0
Describe AWS ECR image from the repository created
aws ecr describe-images --repository-name test_build