File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88env :
99 GCP_REGION : asia-northeast3
10- GCR_HOSTNAME : asia.gcr.io
10+ AR_HOSTNAME : asia-northeast3-docker.pkg.dev
11+ AR_REPOSITORY : bitcoin-pipeline
1112
1213jobs :
1314 build-and-push :
3435 - name : Set up Cloud SDK
3536 uses : google-github-actions/setup-gcloud@v2
3637
37- - name : Configure Docker for GCR
38- run : gcloud auth configure-docker ${{ env.GCR_HOSTNAME }} --quiet
38+ - name : Configure Docker for Artifact Registry
39+ run : gcloud auth configure-docker ${{ env.AR_HOSTNAME }} --quiet
3940
4041 - name : Set up Docker Buildx
4142 uses : docker/setup-buildx-action@v3
@@ -49,11 +50,12 @@ jobs:
4950 - name : Build and push ${{ matrix.service }}
5051 uses : docker/build-push-action@v5
5152 with :
52- context : ./${{ matrix.service }}
53+ context : .
54+ file : ./${{ matrix.service }}/Dockerfile
5355 push : true
5456 tags : |
55- ${{ env.GCR_HOSTNAME }}/${{ secrets.GCP_PROJECT_ID }}/${{ matrix.service }}:latest
56- ${{ env.GCR_HOSTNAME }}/${{ secrets.GCP_PROJECT_ID }}/${{ matrix.service }}:${{ steps.meta.outputs.sha_short }}
57+ ${{ env.AR_HOSTNAME }}/${{ secrets.GCP_PROJECT_ID }}/${{ env.AR_REPOSITORY }}/${{ matrix.service }}:latest
58+ ${{ env.AR_HOSTNAME }}/${{ secrets.GCP_PROJECT_ID }}/${{ env.AR_REPOSITORY }}/${{ matrix.service }}:${{ steps.meta.outputs.sha_short }}
5759 cache-from : type=gha
5860 cache-to : type=gha,mode=max
5961
Original file line number Diff line number Diff line change 11FROM python:3.11-slim
22WORKDIR /app
3- COPY requirements.txt .
3+
4+ # 의존성 설치
5+ COPY collector/requirements.txt .
46RUN pip install --no-cache-dir -r requirements.txt
5- COPY . .
7+
8+ # 코드 복사 (shared 포함)
9+ COPY shared /app/shared
10+ COPY collector /app
11+
612CMD ["python" , "main.py" ]
Original file line number Diff line number Diff line change @@ -8,28 +8,26 @@ services:
88 - bitcoin_network
99
1010 collector :
11- build : ./ collector
11+ image : asia-northeast3-docker.pkg.dev/poised-standard-484213-a7/bitcoin-pipeline/ collector:latest
1212 container_name : bitcoin_collector
1313 depends_on :
1414 - redis
1515 env_file :
1616 - .env
1717 volumes :
1818 - ./keys/gcp-key.json:/keys/gcp-key.json:ro
19- - ./shared:/app/shared:ro
2019 networks :
2120 - bitcoin_network
2221
2322 processor :
24- build : ./ processor
23+ image : asia-northeast3-docker.pkg.dev/poised-standard-484213-a7/bitcoin-pipeline/ processor:latest
2524 container_name : bitcoin_processor
2625 depends_on :
2726 - redis
2827 env_file :
2928 - .env
3029 volumes :
3130 - ./keys/gcp-key.json:/keys/gcp-key.json:ro
32- - ./shared:/app/shared:ro
3331 networks :
3432 - bitcoin_network
3533
Original file line number Diff line number Diff line change 11FROM python:3.11-slim
22WORKDIR /app
3- COPY requirements.txt .
3+
4+ # 의존성 설치
5+ COPY processor/requirements.txt .
46RUN pip install --no-cache-dir -r requirements.txt
5- COPY . .
7+
8+ # 코드 복사 (shared 포함)
9+ COPY shared /app/shared
10+ COPY processor /app
11+
612CMD ["python" , "main.py" ]
Original file line number Diff line number Diff line change @@ -78,4 +78,12 @@ resource "google_compute_firewall" "allow_iap_ssh" {
7878 source_ranges = [" 35.235.240.0/20" ]
7979 target_tags = [" bitcoin-pipeline" ]
8080 priority = 150 # deny_ssh(200)보다 우선순위가 높아야 합니다.
81+ }
82+
83+ # Artifact Registry
84+ resource "google_artifact_registry_repository" "bitcoin_pipeline" {
85+ location = var. region
86+ repository_id = " bitcoin-pipeline"
87+ description = " Docker images for Bitcoin data pipeline"
88+ format = " DOCKER"
8189}
Original file line number Diff line number Diff line change @@ -6,4 +6,9 @@ output "instance_ip" {
66output "ssh_command" {
77 description = " SSH 접속 명령어 (IAP 터널 사용)"
88 value = " gcloud compute ssh bitcoin-pipeline --zone=${ var . zone } --tunnel-through-iap"
9+ }
10+
11+ output "artifact_registry_url" {
12+ description = " Artifact Registry URL"
13+ value = " ${ var . region } -docker.pkg.dev/${ var . project_id } /${ google_artifact_registry_repository . bitcoin_pipeline . repository_id } "
914}
You can’t perform that action at this time.
0 commit comments