Skip to content

Conversation

rsarwar87
Copy link

separate working directory and config directories. config directory to be mounted via docker -v. added coder compose file. also mounting /etc/localtime to ensure correct timezone.

Note: not sure how this will react to HA Addon build. sorry cannot test as i dont use HAOS. also not sure what the naming convensions are.

COPY rootfs /wkspace
RUN wget https://codeload.github.com/springfall2008/batpred/zip/refs/heads/main -O main.zip
RUN unzip main.zip
RUN cp batpred-main/apps/predbat/predbat.py predbat.py
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be *.py?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, with your split design, it should be *py


WORKDIR /config
COPY rootfs /config
WORKDIR /wkspace
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the purpose of the wkspace?

Copy link
Author

@rsarwar87 rsarwar87 Sep 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is where all the downloaded zip files and extraction takes place. also stores the hass.py etc.. in order to keep the config directory clean. been using it for a while with no problem

@nipar4
Copy link

nipar4 commented Sep 1, 2024

I've been thinking the Addon Dockerfiles need a bit of work on GitHub

I wouldn't recommend using multiple RUN & COPY commands as each one creates a snapshot of the filesystem which increases the size of the final image

I like the idea of separate workdir for the python files keeping them separate from the apps.yaml and log files, this is what I am using in some of the images just that I am using the /addon directory however for the 'latest' tag I have kept the files in /config as that's where they are now

This is an extract of that I am using for the Docker Hub image and I see no reason why it cannot be used for the HA Addon as that's just a docker container but would need a few tweaks and to be tested

The run file then just moves thing about checks files are there, that apps.yaml is modified and starts predbat

I am away at the moment but happy to look at more details when I get back

# Use the official Ubuntu image
FROM ubuntu:23.04

# Set shell
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install Python and required packages
RUN apt-get update &&
apt-get upgrade -y &&
apt-get install -y --no-install-recommends
python3
python3-pip
python3-venv
python3-requests
python3-yaml
python3-aiohttp
csh
python3-tz &&
apt-get clean &&
rm -rf /var/lib/apt/lists/*

# Set the working directory
WORKDIR /config

# Copy the rootfs directory to /addon
ADD https://github.com/springfall2008/batpred.git#main:apps/predbat/ https://github.com/springfall2008/batpred.git#main:apps/predbat/config/ rootfs/noble/* /addon/

# Make the startup script executable
RUN chmod +x /addon/run.standalone.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants