{"id":21475162,"url":"https://github.com/snapp-incubator/charlie","last_synced_at":"2025-07-15T09:32:19.283Z","repository":{"id":54330759,"uuid":"495801928","full_name":"snapp-incubator/charlie","owner":"snapp-incubator","description":"Docker image for executing python script directly from repository.","archived":false,"fork":false,"pushed_at":"2023-04-30T09:55:57.000Z","size":1621,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-08-10T03:48:54.909Z","etag":null,"topics":["container","cronjob","docker","github","gitlab","kubernetes","python","python-script","python3","repository","runtime","runtime-system"],"latest_commit_sha":null,"homepage":"","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snapp-incubator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-05-24T11:55:10.000Z","updated_at":"2023-07-31T12:10:13.000Z","dependencies_parsed_at":"2022-08-13T12:10:57.561Z","dependency_job_id":null,"html_url":"https://github.com/snapp-incubator/charlie","commit_stats":null,"previous_names":["amirhnajafiz/assembled","amirhnajafiz/fwfag"],"tags_count":5,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fcharlie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fcharlie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fcharlie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fcharlie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snapp-incubator","download_url":"https://codeload.github.com/snapp-incubator/charlie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226033301,"owners_count":17563125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["container","cronjob","docker","github","gitlab","kubernetes","python","python-script","python3","repository","runtime","runtime-system"],"created_at":"2024-11-23T10:38:02.807Z","updated_at":"2024-11-23T10:38:03.490Z","avatar_url":"https://github.com/snapp-incubator.png","language":"Dockerfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :coin: Charlie\n\n![](https://img.shields.io/github/v/release/amirhnajafiz/charlie)\n![](https://img.shields.io/badge/container_runtime-docker-9cf)\n![](https://img.shields.io/badge/stable-true-blue)\n![](https://img.shields.io/badge/test-pass-success)\n![](https://img.shields.io/badge/language-bash-success)\n![](https://img.shields.io/badge/platform-okd4-yellow)\n\nDocker image for executing python code directly from ```gitlab/github``` repository.\nYou can use this image to execute python scripts on ```okd``` or any other cloud\nplatform without needing any pipeline, dockerfile or anything.\nAll you have to do is build ```charlie``` and then set some ```env``` variable.\nThen login with your ```snapp-cloud``` account into the namespace that you want.\nCreate an image registry, build and push this image into it and use it.\n\nIn ```snappline``` we use ```charlie``` in order to execute ```python``` scripts as ```crob jobs``` in ```okd4```.\n\n## :unlock: Login\n\n```sh\ndocker login -u \u003cokd4-user\u003e -p \u003cokd4-token\u003e \u003cregistery\u003e/\u003cnamespace\u003e\n```\n\n## :heavy_check_mark: Requirements\n\nMake sure to have these files:\n\n- ```script.py``` file which contains the main function of the script.\n- ```libs/requirements.txt``` python project requirements when building the image (this will setup your image with requirements that you need).\nIn this file you have to write your external python libraries. Docker image\nwill be built from this file.\n\n## :hammer: Build\n\nFirst build your image:\n\n```shell\ndocker buildx build --platform linux/amd64 . -t \u003csnapp-image-registery\u003e/\u003cnamespace\u003e/charlie:v0.1.0 -f build/Dockerfile\n```\n\n## :pushpin: Push\n\nPush image to your namespace ```image stream```:\n\n```shell\ndocker push \u003csnapp-image-registery\u003e/\u003cnamespace\u003e/charlie:v0.1.0\n```\n\n## :wrench: Environment Variables\n\n- ```REPOSITORY``` git repository url. Example: ```gitlab.snapp.ir/snappline/api```\n- ```DIRECTORY``` name of the directory when it's done cloning. Example: ```api```\n- ```SCRIPT_PATH``` directory of script. Example: ```script/report```\n- ```HTTP_SECURE``` using ```http``` or ```https```. Expect: ```true/false```\n- ```GIT_SECURE``` if your repository is private set ```true```\n- ```GIT_USER``` repository user for secure option\n- ```GIT_TOKEN``` user token for secure option\n\n## :bomb: Run\n\n### :whale: Docker\n\nUse the built image in order to execute your code:\n\n```shell\ndocker run \\\n--env REPOSITORY='github.com/amirhnajafiz/charlie' \\\n--env DIRECTORY='charlie' \\\n--env SCRIPT_PATH='test' \\\n--mount type=bind,source=\"$(pwd)/clone\",target=/src/clone \\\n\u003csnapp-image-registery\u003e/charlie@v0.1.0\n```\n\n### :ship: Kubernetes Job\n\nExample job that executes once in a day to do something.\n\n#### Configmap\n\n```yml\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: report-configs\ndata:\n  REPOSITORY: 'gitlab_repository'\n  DIRECTORY: 'export'\n  SCRIPT_PATH: 'script'\n  HTTP_SECURE: 'true'\n  GIT_SECURE: 'true'\n  GIT_USER: 'amirhossein.najafizadeh'\n  GIT_TOKEN: 'can be read from secret'\n```\n\n#### Job\n\n```yml\napiVersion: batch/v1\nkind: CronJob\nmetadata:\n  name: report-job\n  labels:\n    app.snappcloud.io/created-by: snappline\n    app: report\nspec:\n  schedule: \"* * */1 * *\"\n  jobTemplate:\n    spec:\n      template:\n        spec:\n          containers:\n            - name: charlie\n              image: \u003cregistery\u003e/\u003cnamespace\u003e/charlie:v0.3.0\n              volumeMounts:\n                - mountPath: /src/clone\n                  name: report-dir\n              envFrom:\n                - configMapRef:\n                    name: report-configs\n          restartPolicy: Never\n          volumes:\n            - name: report-dir\n              emptyDir: { }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapp-incubator%2Fcharlie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnapp-incubator%2Fcharlie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapp-incubator%2Fcharlie/lists"}