Skip to content

Commit

Permalink
[KAN-17] 자동완성 배치 ci/cd 구축 (#4)
Browse files Browse the repository at this point in the history
* [KAN-17] 자동완성 배치 ci/cd 구축

* [KAN-17] 자동완성 배치 ci/cd 구축 - 테스트

* [KAN-17] 자동완성 배치 ci/cd 구축 - 테스트

* [KAN-17] 테스트 롤백
  • Loading branch information
sinkyoungdeok authored Apr 5, 2024
1 parent 0fbc3ae commit 37dc22c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/autocomplete-batch-job.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Autocomplete Batch Job

on:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'

jobs:
batch-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker Build And Push
run: |
docker login -u ${{ secrets.USERNAME }} -p ${{ secrets.PASSWORD }}
docker build -t skku-autocomplete-batch .
docker tag skku-autocomplete-batch sinkyoungdeok/skku-autocomplete-batch
docker push sinkyoungdeok/skku-autocomplete-batch
- name: Deploy Prod
uses: appleboy/[email protected]
with:
key: ${{ secrets.SSH_KEY }}
host: ${{ secrets.HOST_NAME }}
username: ubuntu
port: 22
script: |
docker login -u ${{ secrets.USERNAME }} -p ${{ secrets.PASSWORD }}
docker pull sinkyoungdeok/skku-autocomplete-batch
docker run --net ubuntu_default sinkyoungdeok/skku-autocomplete-batch
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM python:3.8-slim

COPY requirements.txt requirements.txt
COPY restaurants.csv restaurants.csv
COPY main.py main.py

RUN pip install -r requirements.txt

ENTRYPOINT ["python3", "main.py"]
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def apply_highlighting(org_data, highlighted_data):
else:
data[gd] = [json_data]

r = redis.Redis(host='localhost', port=6379, db=0)
r = redis.Redis(host='skku-redis', port=6379, db=0)
version = '20240403232030'
r.set('restaurant:v1:version', version)
r.setex('restaurant:v1:version', 3600 * 24 * 2, version)

for key, value in data.items():
r.set('restaurant:v1:' + version + ':' + key, json.dumps(value))
r.setex('restaurant:v1:' + version + ':' + key, 3600 * 24 * 2, json.dumps(value))
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
redis
pandas

0 comments on commit 37dc22c

Please sign in to comment.