diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index 50d6720..50b86aa 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -67,7 +67,7 @@ jobs: ECR_REPOSITORY: hanghae IMAGE_TAG: latest run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} --build-arg AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT diff --git a/Dockerfile b/Dockerfile index ea497c5..1e850b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,10 @@ FROM openjdk:17-alpine AS builder WORKDIR app +ARG AWS_ACCESS_KEY_ID=ACCESS_KEY_ID +ARG AWS_SECRET_ACCESS_KEY=SECRET_ACCESS_KEY ENV ACTIVE_PROFILE prod COPY ./commerce-api/build/libs/commerce-api-0.0.1.jar . -CMD java -jar -Dspring.profiles.active=${ACTIVE_PROFILE} commerce-api-0.0.1.jar +CMD java -jar -Dspring.profiles.active=${ACTIVE_PROFILE} -DaccessKeyId=${AWS_ACCESS_KEY_ID} -DsecretAccessKey=${AWS_SECRET_ACCESS_KEY} commerce-api-0.0.1.jar