Search

ECR

resource "aws_ecr_repository" "customer" { name = "customer-repo" image_scanning_configuration { scan_on_push = true } tags = { Name = "customer-repo" } } resource "aws_ecr_repository" "product" { name = "product-repo" image_scanning_configuration { scan_on_push = true } tags = { Name = "product-repo" } } resource "aws_ecr_repository" "order" { name = "order-repo" image_scanning_configuration { scan_on_push = true } tags = { Name = "order-repo" } } output "customer_ecr" { value = aws_ecr_repository.customer.id } output "product_ecr" { value = aws_ecr_repository.product.id } output "order_ecr" { value = aws_ecr_repository.order.id }
JSON
복사
FROM alpine # ENV MYSQL_USER=<USERNAME> # ENV MYSQL_PASSWORD=<PASSWORD> # ENV MYSQL_HOST=<RDS_EP> # ENV MYSQL_PORT=<PORT> # ENV MYSQL_DBNAME=dev WORKDIR /app COPY ./customer /app/customer RUN apk update && \ apk add --no-cache libc6-compat libstdc++ libgcc curl openssl && \ apk upgrade --no-cache busybox && \ chmod +x /app/customer EXPOSE 8080 CMD ["/app/customer"]
Docker
복사
FROM alpine # ENV MYSQL_USER=<USERNAME> # ENV MYSQL_PASSWORD=<PASSWORD> # ENV MYSQL_HOST=<RDS_EP> # ENV MYSQL_PORT=<PORT> # ENV MYSQL_DBNAME=dev WORKDIR /app COPY ./product /app/product RUN apk update && \ apk add --no-cache libc6-compat libstdc++ libgcc curl openssl && \ apk upgrade --no-cache busybox && \ chmod +x /app/product EXPOSE 8080 CMD ["/app/product"]
Docker
복사
FROM alpine WORKDIR /app COPY ./order /app/order RUN apk update && \ apk add --no-cache libc6-compat libstdc++ libgcc curl openssl && \ apk upgrade --no-cache busybox && \ chmod +x /app/order EXPOSE 8080 CMD ["/app/order"]
Docker
복사
#!/bin/bash ACCOUNT_ID=$(aws sts get-caller-identity --query "Account" --output text) REGION_CODE=$(aws configure set region us-east-1 && aws configure get region) IMAGE_NAME=("customer" "product" "order") 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-repo:latest ./$name/ docker push $ACCOUNT_ID.dkr.ecr.$REGION_CODE.amazonaws.com/$name-repo:latest done
Shell
복사