OSError: [Errno 8] Exec format error: ‘/var/task/bin/chromedriver’ with make docker-run command

Goal:

Build Docker container to upload selenium web scraper to AWS Lambda using this page as a guide https://robertorocha.info/setting-up-a-selenium-web-scraper-on-aws-lambda-with-python/.

Currently testing local Lambda environment with make docker-run command that outputs the error below:

{"errorType":"OSError","errorMessage":"[Errno 8] Exec format error: '/var/task/bin/chromedriver'",
"stackTrace":["  File "/var/lang/lib/python3.7/imp.py", line 234, in load_modulen    
return load_source(name, filename, file)n","  File "/var/lang/lib/python3.7/imp.py", line 171, in 
load_sourcen    module = _load(spec)n","  File "u003cfrozen importlib._bootstrapu003e", line 696, 
in _loadn","  File "u003cfrozen importlib._bootstrapu003e", line 677, in _load_unlockedn","  
File "u003cfrozen importlib._bootstrap_externalu003e", line 728, in exec_modulen","  
File "u003cfrozen importlib._bootstrapu003e", line 219, in _call_with_frames_removedn","  
File "/var/task/src/lambda_function.py", line 151, in u003cmoduleu003en    
lambda_handler()n","  File "/var/task/src/lambda_function.py", line 34, in lambda_handlern    
driver = webdriver.Chrome(executable_path=os.getcwd() + '/bin/chromedriver', 
chrome_options=chrome_options)n","  File 
"/var/task/lib/selenium/webdriver/chrome/webdriver.py", line 73, in __init__n    
self.service.start()n","  File "/var/task/lib/selenium/webdriver/common/service.py", line 76, 
in startn    stdin=PIPE)n","  File "/var/lang/lib/python3.7/subprocess.py", line 800, in 
__init__n    restore_signals, start_new_session)n","  File 
"/var/lang/lib/python3.7/subprocess.py", line 1551, in _execute_childn    raise 
child_exception_type(errno_num, err_msg, err_filename)n"]} make: *** [docker-run] Error 1

Versions:

chrome 79.0.3945.88
(https://chromedriver.storage.googleapis.com/79.0.3945.36/chromedriver_mac64.zip)

headless-chromium 1.0.0-55

python 3.7.1

from requirement.txt:

boto3==1.9.24

botocore==1.12.24

selenium==3.141

chromedriver-binary==79.0.3945.36

beautifulsoup4==4.6.3

Chromedriver options from scraper script:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('--window-size=1280x1696')
chrome_options.add_argument('--user-data-dir=/tmp/user-data')
chrome_options.add_argument('--hide-scrollbars')
chrome_options.add_argument('--enable-logging')
chrome_options.add_argument('--log-level=0')
chrome_options.add_argument('--v=99')
chrome_options.add_argument('--single-process')
chrome_options.add_argument('--data-path=/tmp/data-path')
chrome_options.add_argument('--ignore-certificate-errors')
chrome_options.add_argument('--homedir=/tmp')
chrome_options.add_argument('--disk-cache-dir=/tmp/cache-dir')
chrome_options.add_argument('user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36')
chrome_options.binary_location = os.getcwd() + '/bin/headless-chromium'

driver = webdriver.Chrome(executable_path=os.getcwd() + '/bin/chromedriver', chrome_options=chrome_options)

Related Makefile code:

    # Get chromedriver
    curl -SL https://chromedriver.storage.googleapis.com/79.0.3945.36/chromedriver_mac64.zip > chromedriver.zip
    unzip chromedriver.zip -d bin/

    # Get Headless-chrome
    curl -SL https://github.com/adieuadieu/serverless-chrome/releases/download/v1.0.0-55/stable-headless-chromium-amazonlinux-2017-03.zip > headless-chromium.zip
    unzip headless-chromium.zip -d bin/

Related docker-compose.yml code (env variables):

# scraper path
PYTHONPATH=/var/task/src:/var/task/lib
# chromedriver and headless-chromium path
PATH=/var/task/bin

Attempts:

Tried downgrading chrome drivers (v2.43, 2.37), selenium (3.14), boto3 (1.6.18), botocore(1.9.18)

Source: StackOverflow