diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..43084b8 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git +.gitea +.dockerignore +Dockerfile +.env +.env.* +!.env.sample +README.md +*.md +node_modules +__pycache__ diff --git a/.env.sample b/.env.sample new file mode 100644 index 0000000..57d5f62 --- /dev/null +++ b/.env.sample @@ -0,0 +1,5 @@ +# 로컬 개발용 env template. cp .env.sample .env 후 본인 환경에 맞게 수정. +# 클러스터 배포 시엔 K8s Secret/value 가 자동 주입되므로 이 파일은 안 쓰임. + +# (prod=spin-backend.internal.svc.cluster.local:80) +SPIN_BACKEND_URL=localhost diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..5fe21b8 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,35 @@ +name: build-and-push +on: + push: + branches: [master, main] +# DinD sidecar(같은 pod, loopback)의 docker daemon 주소. +# runner config의 container.docker_host/options 는 act_runner 0.2.11에서 +# job 안 env로 전파 안 됨 → workflow 레벨에서 명시. +env: + DOCKER_HOST: tcp://localhost:2375 +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install docker CLI + # runner 이미지(node:20-bullseye)에 docker CLI 없음 → DinD sidecar 도달용 client 설치. + run: | + apt-get update -qq + apt-get install -y --no-install-recommends docker.io + - name: Login to Gitea registry + env: + REG_USER: ${{ secrets.REGISTRY_USER }} + REG_PW: ${{ secrets.REGISTRY_TOKEN }} + run: echo "$REG_PW" | docker login git.special-partners.com -u "$REG_USER" --password-stdin + - name: Build + push + run: | + SHA_TAG=git.special-partners.com/admin/spin-frontend:${{ github.sha }} + LATEST=git.special-partners.com/admin/spin-frontend:latest + docker build -t "$SHA_TAG" -t "$LATEST" . + docker push "$SHA_TAG" + docker push "$LATEST" + - name: Hint + run: | + echo "::notice::Pushed git.special-partners.com/admin/spin-frontend:${{ github.sha }} (+ :latest)" + echo "::notice::배포는 ArgoCD Image Updater 가 :latest digest 추적 → infra repo write-back 으로 자동 반영 (수동 set image 불필요)." diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b34f41f --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +.env +.env.local +.env.*.local +node_modules/ +__pycache__/ +*.pyc +dist/ +build/ +.DS_Store diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..fff15c3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,8 @@ +# Placeholder Dockerfile — nginx-unprivileged 기반 static serve, port 8080. +# 실제 코드 추가 후 본인 stack(Node/Python/Go 등)으로 교체 권장. +FROM nginxinc/nginx-unprivileged:1.27-alpine + +# 정적 파일 (html/css/js) 또는 SPA build output 을 root 에 복사. +COPY --chown=nginx:nginx . /usr/share/nginx/html/ + +EXPOSE 8080 diff --git a/README.md b/README.md index 0dc520a..778b249 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ # spin-frontend +배포: [infra repo](https://git.special-partners.com/admin/infra) → `manifests/apps/internal/spin-frontend/` → ArgoCD ApplicationSet `apps` → `internal` ns. + +## CI + +`master` 또는 `main` push → Gitea Actions 가 image build + push (`:` + `:latest`) → `git.special-partners.com/admin/spin-frontend`. + +빌드 결과는 **자동 배포**됩니다 — ArgoCD Image Updater 가 `:latest` digest 변화를 추적해 +infra repo 에 digest 를 write-back 하고 ArgoCD 가 새 이미지로 sync 합니다. (`kubectl set image` 불필요) + +## 필요 repo secrets (Settings → Actions → Secrets and Variables) + +- `REGISTRY_USER` — Gitea username +- `REGISTRY_TOKEN` — Gitea PAT (scope: `read:package`, `write:package`) + - 생성: https://git.special-partners.com/user/settings/applications + +## 환경 변수 + +`.env.sample` 참고. 클러스터에선 K8s Secret/value로 자동 주입. + +## 컨테이너 port + +8080 (Dockerfile EXPOSE). 변경 시 `deployment.yaml`의 containerPort 같이 수정.