Skip to content

Commit

Permalink
Merge pull request #23 from azuki774/apply-single-container
Browse files Browse the repository at this point in the history
Apply single container
  • Loading branch information
azuki774 authored Mar 3, 2024
2 parents ca26676 + c144052 commit 3651a0f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 58 deletions.
2 changes: 1 addition & 1 deletion build/Dockerfile-money-forward
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.11-slim-buster as runner
FROM ghcr.io/azuki774/selenium-chrome:0.2.0
COPY requirements/ /tmp/
RUN pip install --upgrade pip && pip install -r /tmp/moneyforward_requirements.txt

Expand Down
60 changes: 7 additions & 53 deletions deployment/compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
version: '3'
services:
selenium:
image: selenium/standalone-chrome:4.1.4-20220427
container_name: selenium
ports:
- 4444:4444
- 7900:7900
volumes:
- /dev/shm:/dev/shm

# fetcher-api:
# image: bill-fetcher-api
# container_name: bill-fetcher-api
# env_file:
# - api.env
# selenium:
# image: selenium/standalone-chrome:4.1.4-20220427
# container_name: selenium
# ports:
# - "8080:9876"
# - 4444:4444
# - 7900:7900
# volumes:
# - /dev/shm:/dev/shm

money-forward:
image: bill-fetcher-money-forward
Expand All @@ -24,41 +16,3 @@ services:
- money-forward.env
volumes:
- ./:/data/

# remix:
# image: bill-fetcher-remix
# container_name: bill-fetcher-remix
# env_file:
# - remix-token.env
# command:
# - "invoice"

# sbi:
# image: bill-fetcher-sbi
# container_name: bill-fetcher-sbi
# volumes:
# - ./:/data/
# env_file:
# - sbi-token.env

# water:
# image: bill-fetcher-tokyowater
# container_name: bill-fetcher-tokyowater
# volumes:
# - ./:/data/
# env_file:
# - tokyowater-token.env

# nicigas:
# image: bill-fetcher-nicigas
# container_name: bill-fetcher-nicigas
# env_file:
# - nicigas-token.env
# volumes:
# - ./:/data/

# auelect:
# image: bill-fetcher-auelect
# container_name: bill-fetcher-auelect
# volumes:
# - ./:/data/
6 changes: 3 additions & 3 deletions src/moneyforward/alert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
lg.addHandler(h)


notify_address = os.getnev("notify_address")
gmail_account = os.getnev("mail_user")
gmail_password = os.getnev("mail_pass")
notify_address = os.getenv("notify_address")
gmail_account = os.getenv("mail_user")
gmail_password = os.getenv("mail_pass")


def make_mime_text(mail_to, subject, body):
Expand Down
15 changes: 14 additions & 1 deletion src/moneyforward/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,27 @@
lg.addHandler(h)


def get_driver():
def get_driver_standalone():
driver = webdriver.Remote(
command_executor="http://selenium:4444/wd/hub",
options=webdriver.ChromeOptions(),
)
return driver


def get_driver():
options = webdriver.ChromeOptions()
options.add_argument("--headless")
options.add_argument("--no-sandbox")
options.add_argument("--disable-gpu")
options.add_argument("--disable-dev-shm-usage")
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"
options.add_argument("--user-agent=" + UA)
chrome_service = Service(executable_path="/usr/bin/chromedriver")
driver = webdriver.Chrome(service=chrome_service, options=options)
return driver


def main():
lg.info("fetcher start")
lg.info("wait sleep for starting server")
Expand Down

0 comments on commit 3651a0f

Please sign in to comment.