Closed nordcomputer closed 1 year ago
Hi @nordcomputer
Thank you for your issue.
I think the problem is that you didn't set the Zapier_URL env variable but pythons expects it. The docker image is running "python3 main.py" with the options "headless withZapier" (see Dockerfile). So the url is required.
If you want to manually resolve it now there are two possibilities:
I will look into multiple image versions in the future.
If you have any more questions please let me know.
Moin @antonengelhardt, Are you sure about that? Because the same .env file (without a Zapier Url) is running fine on my main machine (Debian on an AMD64 cpu). I am going to try your solution tomorrow.
Moin, @nordcomputer,
i was able to reproduce this.
in the Dockerfile at line 7 the architecture is specified. I created this project on an Intel Machine. I am on M1 now and have the container running on an ubuntu server. I haven't tested this container on my new M1 machine since i got it and therefore your issue is totally legitimate.
I will look into deploying different images for different architecture soon. If you'd like to and found this repo helpful, you can try it yourself and open a MR. Another Dockerfile might be the best approach.
Not this week, but I may look into it next week.
I just forked the repo and tried to get it to run on my pi, but I was out of luck so far.
Instead I tinkered a bit with the main.py file so you can set the hours until tipping via environment variable. I also added an if-clause, to check if ZAPIER_URL is empty.
If you wanna have a look: https://github.com/antonengelhardt/Kicktipp-Bot/compare/main...nordcomputer:Kicktipp-Bot:main
Hey @nordcomputer
I also haven't looked into the architecture matter.
If you have any suggestions please open a PR š
My list for future features is very long and "checking for env" variables is one of them.
Hello again @nordcomputer,
Yesterday, I was able to reproduce it on my Pi aswell.
I think creating a second dockerfile and building another step for this image building & pushing is the best approach.
Sounds good - do you really want a Pull Request, as I just edited the docker-compose file and the main.py - I did not look into the other files....
@nordcomputer
Up to you. But no need
Hello @nordcomputer,
i was able to build the new image and create a container from the image on M1 Mac and Raspberry Pi 4. I still get an Python error, which i will look into later, but the building and running works.
I used this Dockerfile:
Dockerfile.arm:
FROM python:3.8-alpine
# update apk repo
RUN echo "http://dl-4.alpinelinux.org/alpine/v3.14/main" >> /etc/apk/repositories && \
echo "http://dl-4.alpinelinux.org/alpine/v3.14/community" >> /etc/apk/repositories
# install chromedriver
RUN apk update
RUN apk add chromium chromium-chromedriver
# upgrade pip
RUN pip install --upgrade pip
COPY . /app
WORKDIR /app
# Install the Python requirements
RUN pip install -r requirements.txt
# Set the entrypoint to run the Python script
CMD ["python", "./main.py", "headless", "withZapier"]
Build it with docker build -t antonengelhardt/kicktipp-bot:arm -f Dockerfile.arm .
@nordcomputer Also, i found that there is an opportunity to specify the desired platform: https://forums.docker.com/t/run-x86-intel-and-arm-based-images-on-apple-silicon-m1-macs/117123
Simply use
--platform linux/amd64
for docker run
-Commandplatform: linux/amd64
for docker-compose nice, I will give it a try the next days
Hey again @nordcomputer,
the ARM Image is available now: https://hub.docker.com/layers/antonengelhardt/kicktipp-bot/arm/images/sha256-00c82c0e4b91091c8f6bbdf78a935cabb3eaf086fa23dae1d67a814d9d288c44?context=repo
I built it on my M1 with the Dockerfile from above and pushed it. Works on my M1 and on my Raspberry Pi 4.
Reminder: However i am also able to run the "Latest" Image using the --platform linux/amd64
flag. Maybe this is not possible on Pi, havent tested.
I will check out your PR in the next few days. Good changes šš¼ . But i'd like to have two separate Dockerfiles, so that two images are built automatically using GH Actions.
See ya
I was able to build the image on my pi4 and my normal machine with the dockerfile you mentioned above (https://github.com/antonengelhardt/Kicktipp-Bot/issues/3#issuecomment-1484896426) So, I am not sure, but it seems, there is no need for different versions
@nordcomputer Well, i cannot run the arm image on my ubuntu (amd64) machine, so i guess 2 images are needed. Or am i missing something?
As there is no architecture mentioned in the Dockerfile itself, I just tried to use it on my Debian 12 machine - it runs without any issues...
Moin @nordcomputer
What is the Architecture of your Debian machine?
AMD64 - its a Ryzen 5950X
@nordcomputer I get this error when i try to run the arm image on my ubuntu amd64 machine:
WARNING: The requested image's platform (linux/arm64/v8) does not match the detected host platform (linux/amd64) and no specific platform was requested
PS: If you mention me, i also get notified about your replies š
@antonengelhardt did you rebuild the image?
@nordcomputer
No, i built it an hour ago and pushed it to the docker hub. Now there are two tags: latest and arm
@antonengelhardt Also, I use this docker-compose.yml:
version: '3'
services:
bot:
build:
dockerfile: Dockerfile
context: ./
container_name: kicktipp-bot
restart: always
environment:
- KICKTIPP_EMAIL=${KICKTIPP_EMAIL}
- KICKTIPP_PASSWORD=${KICKTIPP_PASSWORD}
- KICKTIPP_NAME_OF_COMPETITION=${KICKTIPP_NAME_OF_COMPETITION}
- ZAPIER_URL=${ZAPIER_URL}
- HOURS_UNTIL_GAME=${HOURS_UNTIL_GAME}
@nordcomputer I assume that the Dockerfile mentioned in your Build context is the Arm version?
@antonengelhardt As you can see in the Dockerfile I (and you) posted, there is no mention of an architecture anywhere. It should be a plain python:3-8-alpine image - or am I misunderstanding something here?
@nordcomputer No, all good.
I am just wondering why its working for you and not for me. My ubuntu machine is just a Server from Hetzner which i use to test amd64 images and deploy containers. I suppose this machine cannot emulate to arm whilst yours can. Do you know if your machine is capable of emulating arm architecture and there is able to execute arm images?
@antonengelhardt I wasnt aware, that there is such thing as an arm emulator for running arm docker images. There seems to be an extra software (qemu), but as far as I am able to google, I would have to explicitly start it, to use it with docker images. And I definitely dont do that...
@nordcomputer
That's what i meant. I have Qemu on my M1 mac to use amd64 VMs.
I think some machines support it out of the box and some don't. I will investigate this a little more in the future. Also thanks again for your PR. Will check it out soon!
No problem and Good night :)
Hey @nordcomputer I have done some changes and commited them on several branches in my repo:
I tried to look into buildx (experimental docker feature) but i didn't get it to work.
Your proposal for the 5th env vars HOURS_UNTIL_GAME
is coming soon. I can't merge your PR as it is but i will use it as a starting point for this feature! Thanks
I tried to set up the docker container via docker-compose.yml but it seems not to work on a Raspberry Pi. It is working fine on my main machine (Debian).
My docker-compose.yml:
The docker logs: