Search

ECR

Product
aws ecr create-repository \ --repository-name product \ --region ap-northeast-2 \ --image-tag-mutability MUTABLE # --image-tag-mutability IMMUTABLE # --image-scanning-configuration scanOnPush=true \
Shell
복사
FROM golang:latest EXPOSE 8080 WORKDIR /app COPY product . RUN chmod +x product CMD ["./product"] RUN mkdir log RUN touch log/app.log RUN ln -sf /dev/stdout log/app.log
Docker
복사
Product Log
aws ecr create-repository \ --repository-name product-log \ --region ap-northeast-2 \ --image-tag-mutability MUTABLE
Shell
복사
extra.conf
FROM public.ecr.aws/aws-observability/aws-for-fluent-bit:init-latest ADD extra.conf /extra.conf
Docker
복사
Stress
aws ecr create-repository \ --repository-name stress \ --region ap-northeast-2 \ --image-tag-mutability MUTABLE # --image-tag-mutability IMMUTABLE # --image-scanning-configuration scanOnPush=true \
Shell
복사
FROM golang:latest EXPOSE 8080 WORKDIR /app COPY stress . RUN chmod +x stress CMD ["./stress"] RUN mkdir log RUN touch log/app.log RUN ln -sf /dev/stdout log/app.log
Docker
복사
Stress Log
aws ecr create-repository \ --repository-name stress-log \ --region ap-northeast-2 \ --image-tag-mutability MUTABLE
Shell
복사
extra.conf
FROM public.ecr.aws/aws-observability/aws-for-fluent-bit:init-latest ADD extra.conf /extra.conf
Docker
복사

Build & Push

#!/bin/bash ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text) REGION_CODE=$(aws configure set region ap-northeast-2 && aws configure get region) IMAGE_NAME=("product" "stress") for name in "${IMAGE_NAME[@]}" do aws ecr get-login-password --region $REGION_CODE | docker login --username AWS --password-stdin $ACCOUNT_ID.dkr.ecr.$REGION_CODE.amazonaws.com docker build -t $ACCOUNT_ID.dkr.ecr.$REGION_CODE.amazonaws.com/$name:latest ./$name/ docker push $ACCOUNT_ID.dkr.ecr.$REGION_CODE.amazonaws.com/$name:latest done
Shell
복사