Dockerize the app
This commit is contained in:
parent
a95aed5c41
commit
ae06a33fa8
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ setting.py
|
||||||
google_api.json
|
google_api.json
|
||||||
__pycache__/
|
__pycache__/
|
||||||
.env
|
.env
|
||||||
|
docker-compose.yml
|
||||||
|
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
FROM python:bookworm
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY src src
|
||||||
|
COPY main.py main.py
|
||||||
|
COPY requirements.txt requirements.txt
|
||||||
|
|
||||||
|
# RUN python -m venv venv
|
||||||
|
# RUN source ./venv/bin/activate
|
||||||
|
RUN pip install -r requirements.txt
|
||||||
|
|
||||||
|
CMD ["python", "main.py"]
|
25
README.md
25
README.md
|
@ -2,6 +2,25 @@
|
||||||
|
|
||||||
[![no github badge](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page/)
|
[![no github badge](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page/)
|
||||||
|
|
||||||
|
## How to run with docker compose
|
||||||
|
|
||||||
|
1. clone repo
|
||||||
|
2. change setting
|
||||||
|
|
||||||
|
```
|
||||||
|
# copy example compose file
|
||||||
|
cp docker-compose.example.yml docker-compose.env
|
||||||
|
|
||||||
|
# edit compose file
|
||||||
|
vim .docker-compose
|
||||||
|
```
|
||||||
|
|
||||||
|
3. RUN
|
||||||
|
|
||||||
|
```
|
||||||
|
docker compose run app
|
||||||
|
```
|
||||||
|
|
||||||
## How to run manually
|
## How to run manually
|
||||||
|
|
||||||
1. clone repo
|
1. clone repo
|
||||||
|
@ -26,12 +45,10 @@ cp .example.env .env
|
||||||
|
|
||||||
# edit setting file
|
# edit setting file
|
||||||
vim .env
|
vim .env
|
||||||
|
```
|
||||||
|
|
||||||
5. RUN
|
5. RUN
|
||||||
```
|
|
||||||
|
|
||||||
|
```
|
||||||
python main.py
|
python main.py
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
13
docker-compose.example.yml
Normal file
13
docker-compose.example.yml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
version: "3.9"
|
||||||
|
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: ./Dockerfile
|
||||||
|
environment:
|
||||||
|
- MISSKEY_INSTANCE_ADDRESS=worldc.one
|
||||||
|
- MISSKEY_ACCESS_TOKEN=BWbGlK6lWuUgXQpFM7igtmbZ30g6BOIc
|
||||||
|
- SENTENCES_FILE=/data/sentences.txt
|
||||||
|
volumes:
|
||||||
|
- ./data:/data
|
12
setup.md
Normal file
12
setup.md
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
# Misskey api key 발급받기
|
||||||
|
|
||||||
|
1. 설정 - api 접속
|
||||||
|
2. 엑세스 토큰 생성 - **"노트를 작성하거나 삭제합니다"** 켬
|
||||||
|
|
||||||
|
# docker compose crontab 설정하기
|
||||||
|
|
||||||
|
```
|
||||||
|
docker compose -f 프로젝트경로/docker-compose.yml up
|
||||||
|
```
|
||||||
|
|
||||||
|
을 crontab에 등록하시면 됩니다(아마도)
|
0
src/__init__.py
Normal file
0
src/__init__.py
Normal file
|
@ -16,5 +16,5 @@ except:
|
||||||
# choose random sentence in google spread sheet
|
# choose random sentence in google spread sheet
|
||||||
def chooseSentence() -> str:
|
def chooseSentence() -> str:
|
||||||
# choice random sentence
|
# choice random sentence
|
||||||
return random.choice(_sentences)
|
return random.choice(_sentences).replace("\\n","\n")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue