Skip to content

๐Ÿ‘ท github-actions self-hosted Runner ์—ฐ๊ฒฐ ๋ฐ ์นด์นด์˜ค ๋งต api ์—ฐ๋™์„ ์œ„ํ•œ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์ˆ˜์ • (Dโ€ฆ #60

๐Ÿ‘ท github-actions self-hosted Runner ์—ฐ๊ฒฐ ๋ฐ ์นด์นด์˜ค ๋งต api ์—ฐ๋™์„ ์œ„ํ•œ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์ˆ˜์ • (Dโ€ฆ

๐Ÿ‘ท github-actions self-hosted Runner ์—ฐ๊ฒฐ ๋ฐ ์นด์นด์˜ค ๋งต api ์—ฐ๋™์„ ์œ„ํ•œ ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ์ˆ˜์ • (Dโ€ฆ #60

name: Front-dev build & push docker image to ghcr and deploy
on:
push:
branches:
- dev
- feature/deploy
pull_request:
branches:
- dev
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
- name: Build Next.js app
run: npm run build
env:
KAKAO_API_KEY: ${{ secrets.KAKAO_API_KEY_DEV }}
KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI_DEV }}
NEXT_PUBLIC_SERVER_URL: ${{ secrets.NEXT_PUBLIC_SERVER_URL_DEV }}
NEXT_PUBLIC_SELF_URL: ${{ secrets.NEXT_PUBLIC_SELF_URL_DEV }}
NEXT_PUBLIC_BASE_URL: ${{ secrets.NEXT_PUBLIC_BASE_URL_DEV }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN_DEV }}
NEXT_PUBLIC_SENTRY_DSN: ${{ secrets.NEXT_PUBLIC_SENTRY_DSN_DEV }}
NEXT_PUBLIC_KAKAOJSKEY: ${{ secrets.NEXT_PUBLIC_KAKAOJSKEY_DEV }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: TopazKang
password: ${{ secrets.GHCR_TOKEN }}
- name: Build Docker image
run: |
docker build \
--build-arg KAKAO_API_KEY=${{ secrets.KAKAO_API_KEY_DEV }} \
--build-arg KAKAO_REDIRECT_URI=${{ secrets.KAKAO_REDIRECT_URI_DEV }} \
--build-arg NEXT_PUBLIC_SERVER_URL=${{ secrets.NEXT_PUBLIC_SERVER_URL_DEV }} \
--build-arg NEXT_PUBLIC_SELF_URL=${{ secrets.NEXT_PUBLIC_SELF_URL_DEV }} \
--build-arg NEXT_PUBLIC_BASE_URL=${{ secrets.NEXT_PUBLIC_BASE_URL_DEV }} \
--build-arg SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN_DEV }} \
--build-arg NEXT_PUBLIC_SENTRY_DSN=${{ secrets.NEXT_PUBLIC_SENTRY_DSN_DEV }} \
--build-arg NEXT_PUBLIC_KAKAOJSKEY=${{ secrets.NEXT_PUBLIC_KAKAOJSKEY_DEV }} \
-t ghcr.io/topazkang/fe-dev:latest .
- name: Push Docker image to GHCR
run: docker push ghcr.io/topazkang/fe-dev:latest
deploy:
runs-on: [ self-hosted, Linux, X64 ]
name: Deploy on Self-Hosted Runner
needs: build
labels:

Check failure on line 67 in .github/workflows/github-actions-dev.yaml

View workflow run for this annotation

GitHub Actions / Front-dev build & push docker image to ghcr and deploy

Invalid workflow file

The workflow is not valid. .github/workflows/github-actions-dev.yaml (Line: 67, Col: 5): Unexpected value 'labels'
- connectrip_fe
steps:
- name: Recreate .env file & login GHCR
run: |
echo "${{ secrets.ENV_FILE_DEV }}" > front/.env
echo "${{ secrets.GHCR_TOKEN }}" | sudo docker login ghcr.io -u ${{ secrets.GIT_USER }} --password-stdin
- name: Prune Docker Images and Deploy With Docker-Compose
run: |
sudo docker image prune -a -f
sudo docker-compose -f front/docker-compose.front.yaml down
sudo docker-compose -f front/docker-compose.front.yaml pull
sudo docker-compose -f front/docker-compose.front.yaml up -d