Help with creating a new add on

I am very new to docker and to making my own addon.

I am trying to build an add on that runs a python script.

My folder structure looks like this:

  • scripts
    • main.py
    • logger.py
    • etc.
  • config.yaml
  • Dockerfile
  • run.sh
  • test.log

I am trying to copy the scripts folder but it does not work.
This is my DOckerfile:

ARG BUILD_FROM

FROM $BUILD_FROM

# Install requirements for add-on

RUN \

apk add --no-cache \

python3

# Python 3 HTTP Server serves the current working dir

# So let's set it to our add-on persistent data directory.

WORKDIR /data

# Copy data for add-on

COPY run.sh /

COPY scripts /data/scripts

RUN chmod a+x /run.sh

CMD [ "/run.sh" ]

This is my run.sh

#!/usr/bin/with-contenv bashio

echo "Checking prerequisites"

python3 -m venv /data/venv

source /data/venv/bin/activate

python3 -m ensurepip --upgrade >/dev/null

pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib lxml requests num2words >/dev/null

echo "Starting Scripts..."

DEBUG=$(bashio::config 'debug')

python3 scripts/main.py $(bashio::config 'debug')

echo Scripts finished

python3 -m http.server 9090

The result I get if I run this is : python3: can't open file '/data/scripts/main.py': [Errno 2] No such file or directory

If try to see the contents of the data dir I only see options.json and a venv folder.

Why are my files not copied?

Maybe the data folder is getting mapped at run time so its contents is getting “hidden” so you should try an other folder that is not getting mapped.

Its true: copying to root worked fine thank you