[chore] Docker CI Pipeline 추가 (#70) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- dev | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Create src/main/resources/bootstrap.yml | |
run: | | |
mkdir -p src/main/resources | |
echo "encrypt:" > src/main/resources/bootstrap.yml | |
echo " key: '${{ secrets.ENCRYPTKEY }}'" >> src/main/resources/bootstrap.yml | |
- name: Login to GitHub Container Registry | |
run: echo ${{ secrets.GTOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Create Release Name | |
id: release_name | |
run: | | |
echo "::set-output name=release_name::v-$(date +'%Y.%m.%d-%H%M%S')" | |
- name: Build and Push Docker Dev Image | |
run: | | |
RELEASE_NAME="${{ steps.release_name.outputs.release_name }}" | |
docker build --build-arg SPRING_PROFILES_ACTIVE=dev -t my-admin-server:latest -f multistage.Dockerfile . | |
docker tag my-admin-server:latest ghcr.io/liberty52/liberty52-admin-server:dev$RELEASE_NAME | |
docker push ghcr.io/liberty52/liberty52-admin-server:dev$RELEASE_NAME | |
- name: Create GitHub Release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ steps.release_name.outputs.release_name }} | |
release_name: Release ${{ steps.release_name.outputs.release_name }} | |
generateReleaseNotes: true | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GTOKEN }} | |
- name: Clean up | |
run: docker logout ghcr.io |