hotfix: 모바일 환경 좋아요 이벤트 에러 수정 #14
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: 🍔 Celuveat frontend PROD CD 🍔 | |
env: | |
PROFILE: prod | |
IMAGE_TAG: front-prod-${{ secrets.APP_VERSION_TAG }} | |
DOCKER_CONTAINER_NAME: frontend | |
DOCKER_HUB_REPOSITORY: celuveat/celuveat | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- "frontend/**" | |
jobs: | |
frontend-build-and-push: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./frontend | |
steps: | |
- name: 🍔 Checkout repository | |
uses: actions/checkout@v3 | |
- name: 🍔 .env 파일 세팅 | |
run: | | |
touch .env | |
echo GOOGLE_MAP_API_KEY=${{ secrets.GOOGLE_MAP_API_KEY }} > .env | |
echo BASE_URL=${{ secrets.PROD_BASE_URL }} >> .env | |
- name: 🍔 DockerHub에 로그인 | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
# Dockerfile에서 yarn 사용하려면 필요함 | |
- name: 🍔 Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: 🍔 Docker Image 빌드 후 DockerHub에 Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile | |
push: true | |
platforms: linux/arm64 | |
tags: ${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
frontend-docker-pull-and-run: | |
runs-on: [self-hosted, prod] | |
if: ${{ needs.frontend-build-and-push.result == 'success' }} | |
needs: [ frontend-build-and-push ] | |
steps: | |
- name: 🍔 DockerHub에서 Image Pull | |
run: | | |
docker login --username ${{ secrets.DOCKER_HUB_USERNAME }} --password ${{ secrets.DOCKER_HUB_PASSWORD }} | |
docker pull ${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
docker stop ${{ env.DOCKER_CONTAINER_NAME }} || true | |
docker container prune -f | |
docker image prune -f | |
- name: 🍔 Docker Image 실행 | |
run: | | |
docker run \ | |
-d \ | |
--name ${{ env.DOCKER_CONTAINER_NAME }} \ | |
-v ~/front-public/images-data/:/app/public/images-data \ | |
-p 3000:3000 \ | |
${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }} |