container, podman pod
This commit is contained in:
parent
bfca1d2e1f
commit
fb968853b5
19
Dockerfile
Normal file
19
Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
FROM python:bookworm
|
||||
|
||||
COPY requirements.txt /
|
||||
|
||||
RUN pip3 install --upgrade pip
|
||||
|
||||
RUN pip3 install -r /requirements.txt
|
||||
|
||||
|
||||
|
||||
COPY ./src /app
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["gunicorn","--config", "gunicorn_config.py", "app:app"]
|
8
podman-commands
Normal file
8
podman-commands
Normal file
@ -0,0 +1,8 @@
|
||||
podman build --tag alipricetrack:1.0.0 -f ./Dockerfile
|
||||
|
||||
|
||||
podman pod create --name aliexpress -p 8080:8080
|
||||
|
||||
podman run -d --pod=aliexpress -e POSTGRES_DB="aliexpress" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" -v /home/fire/Downloads/db:/var/lib/postgresql/data --name ali-db docker.io/postgres
|
||||
|
||||
podman run -d --pod=aliexpress --name ali-app alipricetrack:1.0.0
|
@ -1,4 +1,5 @@
|
||||
Flask
|
||||
gunicorn
|
||||
psycopg2
|
||||
psycopg2-binary
|
||||
requests
|
||||
pyyaml
|
||||
|
@ -34,7 +34,7 @@ def check_items(settings_items):
|
||||
magnifier_image_regex = re.compile(r'<meta property=\"og:image\" content=\"(https:[0-9a-zA-Z\/\-\_.]*)\"\/>')
|
||||
|
||||
session = requests.Session()
|
||||
cookies_file_path = './cookies.json'
|
||||
cookies_file_path = os.path.dirname(os.path.realpath(__file__))+'/cookies.json'
|
||||
cookies = load_cookies_from_file(cookies_file_path)
|
||||
session.cookies.update(cookies)
|
||||
|
||||
|
14
src/app.py
14
src/app.py
@ -11,8 +11,18 @@ def get_conf():
|
||||
settings = yaml.safe_load(conf_file)
|
||||
return settings
|
||||
|
||||
@app.route('/')
|
||||
def hello_world():
|
||||
@app.route('/init')
|
||||
def init_db():
|
||||
print("init")
|
||||
settings = get_conf()
|
||||
initialize(settings["db"])
|
||||
return 'Hello, World!'
|
||||
|
||||
@app.route('/update')
|
||||
def update_hist():
|
||||
print("update")
|
||||
settings = get_conf()
|
||||
fill_db(settings["db"], check_items(settings["item"]))
|
||||
return 'Hello, World!'
|
||||
|
||||
@app.route('/datahistory',methods = ['POST', 'GET'])
|
||||
|
@ -17,5 +17,5 @@ if __name__ == '__main__':
|
||||
# initialize(settings["db"])
|
||||
fill_db(settings["db"], check_items(settings["item"]))
|
||||
|
||||
export_csv(settings["db"])
|
||||
# export_csv(settings["db"])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user