Closed paulbruedgam closed 1 year ago
We shouldn't exclude yaml
as it's a valid format for providing the config for the bot. Other than that, I agree the source code should be inside src.
I think you will not provide the bot config during the build process of the docker image. In the most cases you will provide the config as volume. So it make sense to exclude yaml files via .dockeringnore.
I think i agree with @loomsen regarding the yaml files, as most containers you download from a container register has a default config baked into the dockerfile.
For example nginx:stable bakes a defat config into /etc/nginx/nginx.conf so that it works out of the box with no config you can pretty much do docker run nginx:stable
and it gives you the nice welcome to nginx default page :) Then you map a volume for content as required.
@paulbruedgam as you have some very good suggestions regarding docker, do you have anything that could be useful to add to this. In order to make it more comprehensive or easier to follow? https://github.com/whittlem/pycryptobot/blob/main/docs/DockerBotSetup.md
I have started a .dockerignore file here https://github.com/warrmr/pycryptobot/blob/docker/.dockerignore
.github/
**/docs/
**/chart/
**/tests/
*.log
pycryptobot.log.*
*.key
config-*.yaml
telegram_data*
I am doing some testing with docker image layers and GitHub action caching to try and reduce the build times.
@warrmr do we have a default configuration in yaml which have to ship with the image? If not, we can simply blacklist yaml files. Otherwise, I agree with you. Based on your .dockerignore file I currently testing this extended version:
.git/
.github/
scripts/
**/docs/
**/chart/
**/tests/
.gitignore
Dockerfile*
*.log
pycryptobot.log.*
*.key
telegram_data*
*.ini
*.md
*.sample
*.txt
*.yaml
I believe the default configuration is in the market/template folder and should be shipped. Not sure about the default YAML file.
The README.md file should be included in the docker container otherwise the version number will be blank.
def getVersionFromREADME(self) -> str:
regex = r"^# Python Crypto Bot (v\d{1,3}\.\d{1,3}\.\d{1,3})"
version = "v0.0.0"
try:
with open("README.md", "r", encoding="utf8") as stream:
And I am trying to track down what yaml files need to be included as if you wildcard yaml like you have done it causes a file not found error on bot boot.
Is your feature request related to a problem? Please describe. At the moment, all files of the repo are copied to the Docker image. Not all files are needed for an executable image. One goal for a Docker image should be to keep it as small as possible.
Describe the solution you'd like Docker provides a solution for this in the form of the .dockerignore file. A small sample looks like
It might be helpful to reorganize the repo and put the source code in a separate folder, like src. The root directory of the repo would then also look cleaner.