├── .checkov.yml
├── .dockerignore
├── .editorconfig
├── .github
├── ISSUE_TEMPLATE
│ ├── issue.bug.yml
│ └── issue.feature.yml
├── PULL_REQUEST_TEMPLATE.md
└── workflows
│ ├── deploy-docker-image.yml
│ ├── greetings.yml
│ ├── lint-pr-title.yml
│ └── mega-linter.yml
├── .hadolint.yml
├── .markdown-link-check.json
├── .mega-linter.yml
├── .renovaterc.json
├── .trivyignore
├── .trufflehogignore.txt
├── .yamllint.yml
├── Banner.png
├── Dockerfile
├── LICENSE
├── README.md
├── root
├── etc
│ ├── crontabs
│ │ ├── abc
│ │ └── root
│ └── s6-overlay
│ │ └── s6-rc.d
│ │ ├── init-config-end
│ │ └── dependencies.d
│ │ │ └── init-packt-cli-config
│ │ ├── init-crontabs-config
│ │ ├── dependencies.d
│ │ │ └── init-packt-cli-config
│ │ ├── run
│ │ ├── type
│ │ └── up
│ │ ├── init-packt-cli-config
│ │ ├── dependencies.d
│ │ │ └── init-config
│ │ ├── run
│ │ ├── type
│ │ └── up
│ │ ├── svc-cron
│ │ ├── dependencies.d
│ │ │ └── init-services
│ │ ├── run
│ │ └── type
│ │ └── user
│ │ └── contents.d
│ │ ├── init-crontabs-config
│ │ ├── init-packt-cli-config
│ │ └── svc-cron
└── opt
│ └── requirements.txt
└── sonar-project.properties
/.checkov.yml:
--------------------------------------------------------------------------------
1 | ---
2 | quiet: true
3 | skip-check:
4 | - CKV_DOCKER_3 # lsio images run containers as non-root by default
5 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | .*
2 | .github
3 | Dockerfile
4 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | trim_trailing_whitespace = true
6 | insert_final_newline = true
7 | end_of_line = lf
8 |
9 | [**.md]
10 | indent_style = space
11 | indent_size = 2
12 |
13 | [**.sh]
14 | indent_style = space
15 | indent_size = 4
16 | switch_case_indent = true # like -ci
17 | space_redirects = true # like -sr
18 |
19 | [**.yaml,**.yml]
20 | indent_style = space
21 | indent_size = 2
22 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/issue.bug.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # Based on the issue template
3 | name: Bug report
4 | description: Create a report to help us improve
5 | title: "[BUG]
"
6 | labels: [Bug]
7 | body:
8 | - type: checkboxes
9 | attributes:
10 | label: Is there an existing issue for this?
11 | description: Please search to see if an issue already exists for the bug you encountered.
12 | options:
13 | - label: I have searched the existing issues
14 | required: true
15 | - type: textarea
16 | attributes:
17 | label: Current Behavior
18 | description: Tell us what happens instead of the expected behavior.
19 | validations:
20 | required: true
21 | - type: textarea
22 | attributes:
23 | label: Expected Behavior
24 | description: Tell us what should happen.
25 | validations:
26 | required: false
27 | - type: textarea
28 | attributes:
29 | label: Steps To Reproduce
30 | description: Steps to reproduce the behavior.
31 | placeholder: |
32 | 1. In this environment...
33 | 2. With this config...
34 | 3. Run '...'
35 | 4. See error...
36 | validations:
37 | required: true
38 | - type: textarea
39 | attributes:
40 | label: Docker creation
41 | description: |
42 | Command used to create docker container
43 | Provide your docker create/run command or compose yaml snippet, or a screenshot of settings if using a gui to create the container
44 | render: bash
45 | validations:
46 | required: true
47 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/issue.feature.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # Based on the issue template
3 | name: Feature request
4 | description: Suggest an idea for this project
5 | title: "[FEAT] "
6 | labels: [enhancement]
7 | body:
8 | - type: checkboxes
9 | attributes:
10 | label: Is this a new feature request?
11 | description: Please search to see if a feature request already exists.
12 | options:
13 | - label: I have searched the existing issues
14 | required: true
15 | - type: textarea
16 | attributes:
17 | label: Wanted change
18 | description: Tell us what you want to happen.
19 | validations:
20 | required: true
21 | - type: textarea
22 | attributes:
23 | label: Reason for change
24 | description: Justify your request, why do you want it, what is the benefit.
25 | validations:
26 | required: true
27 | - type: textarea
28 | attributes:
29 | label: Proposed code change
30 | description: Do you have a potential code change in mind?
31 | validations:
32 | required: false
33 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | # Pull Request
2 |
3 | ## Description
4 |
5 | -
6 |
7 | ## Benefits of this PR and context
8 |
9 | -
10 |
11 | ## How Has This Been Tested?
12 |
13 | -
14 |
--------------------------------------------------------------------------------
/.github/workflows/deploy-docker-image.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: build-and-push-docker-image
3 |
4 | permissions: read-all
5 |
6 | on:
7 | push:
8 | branches:
9 | - main
10 |
11 | jobs:
12 | docker:
13 | runs-on: ubuntu-latest
14 | permissions:
15 | packages: write
16 | steps:
17 | # Checks out the main branch of the repository to the runner
18 | - name: checkout
19 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20 | with:
21 | fetch-depth: "0"
22 |
23 | # This action creates a new git tag of the main branch with the new version number
24 | - name: Bump version and push tag
25 | id: bumpTag
26 | uses: anothrNick/github-tag-action@e528bc2b9628971ce0e6f823f3052d1dcd9d512c # 1.73.0
27 | env:
28 | GITHUB_TOKEN: ${{ secrets.PAT }}
29 | WITH_V: true
30 |
31 | # Sets up the QEMU emulator that emulates different architectures
32 | - name: Set up QEMU
33 | uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
34 |
35 | # Sets up the Docker Buildx plugin to build multi-architecture Docker images
36 | - name: Set up Docker Buildx
37 | uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
38 |
39 | # Authenticates with Docker Hub
40 | - name: Login to Docker Hub
41 | uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
42 | with:
43 | registry: docker.io
44 | username: ${{ secrets.DOCKERHUB_USERNAME }}
45 | password: ${{ secrets.DOCKERHUB_TOKEN }}
46 |
47 | # Authenticates with the GitHub Container Registry
48 | - name: Login to GitHub Package Registry
49 | uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
50 | with:
51 | registry: ghcr.io
52 | username: ${{ github.repository_owner }}
53 | password: ${{ secrets.GITHUB_TOKEN }}
54 |
55 | - name: Extract metadata (tags, labels) for Docker
56 | id: metadata
57 | uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
58 | with:
59 | images: |
60 | ${{ github.repository }}
61 | ghcr.io/${{ github.repository }}
62 | tags: |
63 | type=raw,value=latest,enable={{is_default_branch}}
64 | # type=raw,value={{branch}}
65 |
66 | # Builds and pushes the Docker image to Docker Hub and the GitHub Container Registry with the following tags:
67 | # - 'latest' for successful builds on the main branch.
68 | # - '' pushes to non-main branches.
69 | - name: Build and push Docker image
70 | uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
71 | with:
72 | context: .
73 | push: true
74 | platforms: linux/amd64,linux/arm64
75 | tags: ${{ steps.metadata.outputs.tags }}
76 | labels: ${{ steps.metadata.outputs.labels }}
77 |
78 | # - name: SonarCloud Scan
79 | # uses: SonarSource/sonarcloud-github-action@5875562561d22a34be0c657405578705a169af6c # v1.9.1
80 | # env:
81 | # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
82 | # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
83 |
84 | # Create a release based on the new tag
85 | - name: Create release
86 | uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
87 | with:
88 | tag_name: ${{ steps.bumpTag.outputs.new_tag }}
89 | env:
90 | GITHUB_TOKEN: ${{ secrets.PAT }}
91 |
--------------------------------------------------------------------------------
/.github/workflows/greetings.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: Greetings
3 |
4 | permissions: read-all
5 |
6 | on: [pull_request_target, issues]
7 |
8 | jobs:
9 | greeting:
10 | runs-on: ubuntu-latest
11 | permissions:
12 | pull-requests: write
13 | issues: write
14 | steps:
15 | - name: First Interaction
16 | uses: actions/first-interaction@34f15e814fe48ac9312ccf29db4e74fa767cbab7 # v1.3.0
17 | with:
18 | issue-message: "Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid."
19 | pr-message: "Thanks for opening this pull request! Be sure to follow the [pull request template](https://github.com/GhostWriters/docker-packt-cli/blob/main/.github/PULL_REQUEST_TEMPLATE.md)!"
20 | repo-token: ${{ secrets.GITHUB_TOKEN }}
21 |
--------------------------------------------------------------------------------
/.github/workflows/lint-pr-title.yml:
--------------------------------------------------------------------------------
1 | ---
2 | name: "Lint PR Title"
3 |
4 | permissions: read-all
5 |
6 | on:
7 | pull_request_target:
8 | types:
9 | - opened
10 | - edited
11 | - synchronize
12 |
13 | jobs:
14 | main:
15 | name: Validate PR title
16 | runs-on: ubuntu-latest
17 | steps:
18 | - name: Check Title
19 | uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5.5.3
20 | env:
21 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 |
--------------------------------------------------------------------------------
/.github/workflows/mega-linter.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # MegaLinter GitHub Action configuration file
3 | # More info at https://megalinter.io
4 | name: Mega-Linter
5 |
6 | permissions: read-all
7 |
8 | on:
9 | # Trigger mega-linter at every push. Action will also be visible from Pull Requests to main
10 | push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions)
11 | pull_request:
12 | branches: [main]
13 |
14 | env: # Comment env block if you do not want to apply fixes
15 | # Apply linter fixes configuration
16 | APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
17 | APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
18 | APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)
19 |
20 | concurrency:
21 | group: ${{ github.ref }}-${{ github.workflow }}
22 | cancel-in-progress: true
23 |
24 | jobs:
25 | build:
26 | name: MegaLinter
27 | runs-on: ubuntu-latest
28 | permissions:
29 | pull-requests: write
30 | steps:
31 | # Git Checkout
32 | - name: Checkout Code
33 | uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34 | with:
35 | token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
36 | fetch-depth: ${{ github.event_name == 'pull_request' && '0' || '1' }}
37 |
38 | # MegaLinter
39 | - name: MegaLinter
40 | id: ml
41 | # To improve performance, you have the option to change the MegaLinter flavor that is being used.
42 | # Complete details on available flavors can be found at https://megalinter.io/flavors/.
43 | uses: oxsecurity/megalinter@5a91fb06c83d0e69fbd23756d47438aa723b4a5a # v8.7.0
44 | env:
45 | # All available variables are described in documentation
46 | # https://megalinter.io/configuration/
47 | VALIDATE_ALL_CODEBASE: ${{ github.event_name == 'pull_request' }} # Validates all source when its a PR, else just the git diff with main.
48 | PAT: ${{ secrets.PAT }}
49 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50 |
51 | # Upload MegaLinter artifacts
52 | - name: Archive production artifacts
53 | if: success() || failure()
54 | uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
55 | with:
56 | name: MegaLinter reports
57 | path: |
58 | megalinter-reports
59 | mega-linter.log
60 |
61 | # Create pull request if applicable (for now works only on PR from same repository, not from forks)
62 | - name: Create Pull Request with applied fixes
63 | id: cpr
64 | if: always() &&
65 | steps.ml.outputs.has_updated_sources == 1 &&
66 | env.APPLY_FIXES_MODE == 'pull_request' &&
67 | (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) &&
68 | (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
69 | uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
70 | with:
71 | token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
72 | commit-message: "[MegaLinter] Apply linters automatic fixes"
73 | title: "[MegaLinter] Apply linters automatic fixes"
74 | labels: bot
75 | - name: Create PR output
76 | if: always() && steps.cpr.conclusion == 'success'
77 | run: |
78 | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
79 | echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
80 |
81 | # Push new commit if applicable (for now works only on PR from same repository, not from forks)
82 | - name: Prepare commit
83 | id: pc
84 | if: always() &&
85 | steps.ml.outputs.has_updated_sources == 1 &&
86 | env.APPLY_FIXES_MODE == 'commit' &&
87 | github.ref != 'refs/heads/main' &&
88 | (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) &&
89 | (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
90 | run: sudo chown -Rc $UID .git/
91 | - name: Commit and push applied linter fixes
92 | if: always() && steps.pc.conclusion == 'success'
93 | uses: stefanzweifel/git-auto-commit-action@b863ae1933cb653a53c021fe36dbb774e1fb9403 # v5.2.0
94 | with:
95 | branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
96 | commit_message: "[MegaLinter] Apply linters fixes"
97 | commit_user_name: megalinter-bot
98 |
--------------------------------------------------------------------------------
/.hadolint.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ##########################
3 | ## Hadolint config file ##
4 | ##########################
5 | ignored:
6 | - DL3013 # Pin versions in pip.
7 | - DL3018 # Pin versions in apk add.
8 |
9 | trustedRegistries:
10 | - docker.io
11 | - ghcr.io
12 |
--------------------------------------------------------------------------------
/.markdown-link-check.json:
--------------------------------------------------------------------------------
1 | {
2 | "ignorePatterns": [
3 | {
4 | "pattern": "^https://hub.docker.com*"
5 | }
6 | ],
7 |
8 | "retryOn429": true,
9 | "retryCount": 5,
10 | "aliveStatusCodes": [200, 203]
11 | }
12 |
--------------------------------------------------------------------------------
/.mega-linter.yml:
--------------------------------------------------------------------------------
1 | # Configuration file for MegaLinter
2 | # See all available variables at https://megalinter.github.io/configuration/ and in linters documentation
3 | ---
4 | DISABLE:
5 | - COPYPASTE
6 | - SPELL
7 |
8 | DISABLE_LINTERS:
9 | - REPOSITORY_DEVSKIM # Disabled as currently not working with .net 9
10 | - REPOSITORY_KICS # TODO: Fix KICS linter issues and re-enable
11 |
12 | DOCKERFILE_HADOLINT_CONFIG_FILE: .hadolint.yml
13 | ERROR_ON_MISSING_EXEC_BIT: true
14 | FORMATTERS_DISABLE_ERRORS: false
15 | IGNORE_GENERATED_FILES: true
16 | JSON_JSONLINT_ARGUMENTS: "-B"
17 | MARKDOWN_MARKDOWNLINT_DISABLE_ERRORS: false
18 | PRINT_ALL_FILES: false
19 | REPOSITORY_TRUFFLEHOG_ARGUMENTS: --exclude-paths=.trufflehogignore.txt
20 | SHOW_ELAPSED_TIME: true
21 | VALIDATE_ALL_CODEBASE: true
22 | YAML_YAMLLINT_ARGUMENTS: "--strict"
23 |
--------------------------------------------------------------------------------
/.renovaterc.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3 | "extends": ["config:base", ":semanticCommits"],
4 | "automerge": true
5 | }
6 |
--------------------------------------------------------------------------------
/.trivyignore:
--------------------------------------------------------------------------------
1 | DS002
2 |
--------------------------------------------------------------------------------
/.trufflehogignore.txt:
--------------------------------------------------------------------------------
1 | .git
2 |
--------------------------------------------------------------------------------
/.yamllint.yml:
--------------------------------------------------------------------------------
1 | # Configuration file for yamllint.
2 | # Documentation: https://yamllint.readthedocs.io/en/stable/configuration.html
3 | ---
4 | extends: default
5 |
6 | rules:
7 | comments:
8 | min-spaces-from-content: 1
9 | line-length:
10 | max: 205
11 | truthy:
12 | # uses the key 'on' without quotes which fails the truthy check
13 | ignore: |
14 | .github/workflows/deploy-docker-image.yml
15 | .github/workflows/greetings.yml
16 | .github/workflows/lint-pr-title.yml
17 | .github/workflows/mega-linter.yml
18 |
--------------------------------------------------------------------------------
/Banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/Banner.png
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | # Set the base image
2 | FROM ghcr.io/linuxserver/baseimage-alpine:3.21@sha256:45ac6d2513fe7bb13d51f5898867f71bf81a8e366f31c5856194accd53ded632
3 |
4 | # Set the maintainer
5 | LABEL maintainer="GhostWriters"
6 |
7 | # copy local files
8 | COPY root/ /
9 |
10 | # Install required packages and application dependencies
11 | RUN \
12 | echo "**** install runtime packages ****" && \
13 | apk add --no-cache \
14 | py3-pip && \
15 | echo "**** install app ****" && \
16 | pip3 install --break-system-packages --no-cache-dir -r /opt/requirements.txt && \
17 | echo "**** cleanup ****" && \
18 | rm -rf \
19 | /tmp/* \
20 | "$HOME/.cache"
21 |
22 | # Add a health check command to ensure the container is running correctly
23 | HEALTHCHECK --interval=15m \
24 | --timeout=3s \
25 | CMD ps -ef | grep cron || exit 1 \
26 | && ping -c 1 www.packtpub.com >/dev/null 2>&1 || exit 1
27 |
28 | # Volume where the config file and crontab
29 | VOLUME /config
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | # MIT License
2 |
3 | Copyright (c) 2021 GhostWriters
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # docker-packt-cli
2 |
3 | 
4 |
5 | [](https://github.com/GhostWriters/docker-packt-cli/graphs/contributors)
6 | [](https://github.com/GhostWriters/docker-packt-cli/commits/main)
7 | [](https://github.com/GhostWriters/docker-packt-cli/blob/main/LICENSE)
8 | [](https://github.com/renovatebot/renovate)
9 |
10 | A Docker container for automatically downloading a free eBook each day from Packt publishing using the `packt-cli` tool.
11 |
12 | ## Usage
13 |
14 | To run the `docker-packt-cli` container, use the following `docker run` command:
15 |
16 | ```docker
17 | docker run -d \
18 | --name=packt --rm \
19 | -e PACKT_EMAIL= \
20 | -e PACKT_PASSWORD= \
21 | -e PACKT_DOWNLOAD_FORMATS=pdf,epub,mobi,code \
22 | -e PACKT_ANTICAPTCHA_KEY= \
23 | -e PACKT_SMTP_HOST \
24 | -e PACKT_SMTP_PORT <587> \
25 | -e PACKT_SMTP_PASSWORD \
26 | -e PACKT_SMTP_EMAIL \
27 | -e PACKT_SMTP_TO_EMAILS \
28 | -e PACKT_SMTP_KINDLE_EMAILS \
29 | -e PUID= \
30 | -e PGID= \
31 | -e TZ= \
32 | -v /home/user/packt/config:/config \
33 | -v /home/user/packt/books:/data \
34 | --restart unless-stopped
35 | ghcr.io/ghostwriters/docker-packt-cli:latest
36 | ```
37 |
38 | You will need to replace `` and `` with your Packt account email and password, respectively. Additionally, you can customize the output formats of the downloaded books by modifying the `PACKT_DOWNLOAD_FORMATS` environment variable. The default formats are `pdf`, `epub`, `mobi`, and `code`.
39 |
40 | To automatically solve the CAPTCHA, you will need an [AntiCaptcha](https://anti-captcha.com/) API key, which you can set by attaching the `-e PACKT_ANTICAPTCHA_KEY=` flag to your docker run command.
41 |
42 | `PACKT_SMTP_HOST`, `PACKT_SMTP_PORT`, `PACKT_SMTP_PASSWORD`, `PACKT_SMTP_EMAIL`, `PACKT_SMTP_TO_EMAILS`, `PACKT_SMTP_KINDLE_EMAILS`: These parameters are related to the email notifications feature. If you want to receive email notifications about the downloaded eBooks, you need to provide the SMTP server details and the email addresses for sending the notifications.
43 |
44 | You can mount two volumes to persist the Packt credentials and store the downloaded books in a directory on your host system. The `/config` directory will store your Packt credentials, and the `/data` directory will store the downloaded books. You can change the paths of the host directories by modifying the values after the `-v` flag.
45 |
46 | If you would prefer to use an alternative to ghcr.io, you can use the image hosted on [Docker Hub](https://hub.docker.com/repository/docker/ghostwriters/docker-packt-cli/general) `ghostwriters/docker-packt-cli:latest`,
47 |
48 | ## GitHub Actions Used
49 |
50 | - [actions/checkout](https://github.com/actions/checkout) - Action for checking out code from a repository.
51 | - [actions/first-interaction](https://github.com/actions/first-interaction) - Action to identify a user's first contribution to a repository.
52 | - [actions/upload-artifact](https://github.com/actions/upload-artifact) - Action for uploading artifacts for later use in the workflow.
53 | - [amannn/action-semantic-pull-request](https://github.com/amannn/action-semantic-pull-request) - Action for enforcing conventional commit messages and semantic versioning.
54 | - [anothrNick/github-tag-action](https://github.com/anothrNick/github-tag-action) - Action for automatically creating a new tag and release based on version numbers.
55 | - [docker/build-push-action](https://github.com/docker/build-push-action) - Action for building and pushing Docker images.
56 | - [docker/login-action](https://github.com/docker/login-action) - Action for logging in to a Docker registry.
57 | - [docker/metadata-action](https://github.com/docker/metadata-action) - Action for adding Docker metadata to a GitHub repository.
58 | - [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) - Action for setting up Buildx on your Github Actions runner.
59 | - [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) - Action for setting up QEMU for cross-builds.
60 | - [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) - Action for creating pull requests programmatically.
61 | - [softprops/action-gh-release](https://github.com/softprops/action-gh-release) - Action for creating GitHub releases.
62 | - [stefanzweifel/git-auto-commit-action](https://github.com/stefanzweifel/git-auto-commit-action) - Action for automatically committing changes to a repository.
63 | - [oxsecurity/megalinter](https://github.com/oxsecurity/megalinter) - Action for linting multiple languages at once.
64 |
65 | ## Contributing
66 |
67 | If you have any feedback or run into issues with the container, please open an [issue](https://github.com/GhostWriters/docker-packt-cli/issues/new) on the GitHub repository. If you would like to contribute to this project, you can submit a [pull request](https://github.com/GhostWriters/docker-packt-cli/pulls).
68 |
69 | ## Special Thanks
70 |
71 | - [packt-cli](https://gitlab.com/packt-cli/packt-cli) for maintaining the package to handle the downloading.
72 | - [LinuxServer.io](https://www.linuxserver.io) for maintaining the Docker image used in this project.
73 |
74 | ## License
75 |
76 | This project is licensed under the MIT License. See the [LICENSE](https://github.com/GhostWriters/docker-packt-cli/blob/main/LICENSE) file for more details.
77 |
--------------------------------------------------------------------------------
/root/etc/crontabs/abc:
--------------------------------------------------------------------------------
1 | # min hour day month weekday command
2 | 0 8 * * * packt-cli -gd -sm -c /config/configFile.cfg 2>&1 | tee /config/logFile.log
3 |
--------------------------------------------------------------------------------
/root/etc/crontabs/root:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/root/etc/crontabs/root
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-packt-cli-config:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-packt-cli-config
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/dependencies.d/init-packt-cli-config:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/dependencies.d/init-packt-cli-config
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/run:
--------------------------------------------------------------------------------
1 | #!/usr/bin/with-contenv bash
2 | # shellcheck shell=bash
3 |
4 | # make folders
5 | mkdir -p \
6 | /config/crontabs
7 |
8 | ## root
9 | # if crontabs do not exist in config
10 | if [[ ! -f /config/crontabs/root ]]; then
11 | # copy crontab from system
12 | if crontab -l -u root; then
13 | crontab -l -u root >/config/crontabs/root
14 | fi
15 |
16 | # if crontabs still do not exist in config (were not copied from system)
17 | # copy crontab from included defaults (using -n, do not overwrite an existing file)
18 | cp -n /etc/crontabs/root /config/crontabs/
19 | fi
20 | # set permissions and import user crontabs
21 | lsiown root:root /config/crontabs/root
22 | crontab -u root /config/crontabs/root
23 |
24 | ## abc
25 | # if crontabs do not exist in config
26 | if [[ ! -f /config/crontabs/abc ]]; then
27 | # copy crontab from system
28 | if crontab -l -u abc; then
29 | crontab -l -u abc >/config/crontabs/abc
30 | fi
31 |
32 | # if crontabs still do not exist in config (were not copied from system)
33 | # copy crontab from included defaults (using -n, do not overwrite an existing file)
34 | cp -n /etc/crontabs/abc /config/crontabs/
35 | fi
36 | # set permissions and import user crontabs
37 | lsiown abc:abc /config/crontabs/abc
38 | crontab -u abc /config/crontabs/abc
39 |
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/type:
--------------------------------------------------------------------------------
1 | oneshot
2 |
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-crontabs-config/up:
--------------------------------------------------------------------------------
1 | /etc/s6-overlay/s6-rc.d/init-crontabs-config/run
2 |
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-packt-cli-config/dependencies.d/init-config:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/root/etc/s6-overlay/s6-rc.d/init-packt-cli-config/dependencies.d/init-config
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-packt-cli-config/run:
--------------------------------------------------------------------------------
1 | #!/usr/bin/with-contenv bash
2 | # shellcheck shell=bash
3 |
4 | CFG="/config/configFile.cfg"
5 |
6 | # Downloads and copies a new configfile template if one is not present in the config dir.
7 | if [[ ! -f "$CFG" ]]; then
8 | echo "No config file, providing sample"
9 | wget -O "$CFG" https://gitlab.com/packt-cli/packt-cli/-/raw/master/configFileTemplate.cfg
10 | fi
11 |
12 | # If environment arguments have been provided, switch the values in the config to these.
13 | if [[ -n "$PACKT_EMAIL" ]]; then
14 | echo "ENV PACKT_EMAIL provided"
15 | sed -i "s/email=.*/email=$PACKT_EMAIL/" "$CFG"
16 | else
17 | echo "ENV PACKT_EMAIL not set"
18 | fi
19 |
20 | if [[ -n "$PACKT_PASSWORD" ]]; then
21 | echo "ENV PACKT_PASSWORD provided"
22 | sed -i "s/password=.*/password=$PACKT_PASSWORD/" "$CFG"
23 | else
24 | echo "ENV PACKT_PASSWORD not set"
25 | fi
26 |
27 | if [[ -n "$PACKT_DOWNLOAD_FORMATS" ]]; then
28 | echo "ENV PACKT_DOWNLOAD_FORMATS provided as \"$PACKT_DOWNLOAD_FORMATS\""
29 | sed -i "s/download_formats:.*/download_formats:\ $PACKT_DOWNLOAD_FORMATS/" "$CFG"
30 | else
31 | echo "ENV PACKT_DOWNLOAD_FORMATS not set"
32 | fi
33 |
34 | if [[ -n "$PACKT_ANTICAPTCHA_KEY" ]]; then
35 | echo "ENV PACKT_ANTICAPTCHA_Key provided"
36 | sed -i "s/key:.*/key:\ $PACKT_ANTICAPTCHA_KEY/" "$CFG"
37 | else
38 | echo "ENV PACKT_ANTICAPTCHA_KEY not set"
39 | fi
40 |
41 | if [[ -n "$PACKT_SMTP_HOST" ]]; then
42 | echo "ENV PACKT_SMTP_HOST provided"
43 | sed -i "s/host:.*/host:\ $PACKT_SMTP_HOST/" "$CFG"
44 | else
45 | echo "ENV PACKT_SMTP_HOST not set"
46 | fi
47 |
48 | if [[ -n "$PACKT_SMTP_PORT" ]]; then
49 | echo "ENV PACKT_SMTP_PORT provided"
50 | sed -i "s/port:.*/port:\ $PACKT_SMTP_PORT/" "$CFG"
51 | else
52 | echo "ENV PACKT_SMTP_PORT not set"
53 | fi
54 |
55 | if [[ -n "$PACKT_SMTP_PASSWORD" ]]; then
56 | echo "ENV PACKT_SMTP_PASSWORD provided"
57 | sed -i "s/password:.*/password:\ $PACKT_SMTP_PASSWORD/" "$CFG"
58 | else
59 | echo "ENV PACKT_SMTP_PASSWORD not set"
60 | fi
61 |
62 | if [[ -n "$PACKT_SMTP_EMAIL" ]]; then
63 | echo "ENV PACKT_SMTP_EMAIL provided"
64 | sed -i "s/email:.*/email:\ $PACKT_SMTP_EMAIL/" "$CFG"
65 | else
66 | echo "ENV PACKT_SMTP_EMAIL not set"
67 | fi
68 |
69 | if [[ -n "$PACKT_SMTP_TO_EMAILS" ]]; then
70 | echo "ENV PACKT_SMTP_TO_EMAILS provided"
71 | sed -i "s/to_emails:.*/to_emails:\ $PACKT_SMTP_TO_EMAILS/" "$CFG"
72 | else
73 | echo "ENV PACKT_SMTP_TO_EMAILS not set"
74 | fi
75 |
76 | if [[ -n "$PACKT_SMTP_KINDLE_EMAILS" ]]; then
77 | echo "ENV PACKT_SMTP_KINDLE_EMAILS provided"
78 | sed -i "s/kindle_emails:.*/kindle_emails:\ $PACKT_SMTP_KINDLE_EMAILS/" "$CFG"
79 | else
80 | echo "ENV PACKT_SMTP_KINDLE_EMAILS not set"
81 | fi
82 |
83 | echo "Replacing path with /data"
84 | sed -i "s@download_folder_path:.*@download_folder_path:\ \\/data@" "$CFG"
85 |
86 | # set permissions
87 | lsiown -R abc:abc /config
88 |
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-packt-cli-config/type:
--------------------------------------------------------------------------------
1 | oneshot
2 |
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/init-packt-cli-config/up:
--------------------------------------------------------------------------------
1 | /etc/s6-overlay/s6-rc.d/init-packt-cli-config/run
2 |
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/svc-cron/dependencies.d/init-services:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/root/etc/s6-overlay/s6-rc.d/svc-cron/dependencies.d/init-services
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/svc-cron/run:
--------------------------------------------------------------------------------
1 | #!/usr/bin/with-contenv bash
2 | # shellcheck shell=bash
3 |
4 | exec /usr/sbin/crond -f -S -l 5
5 |
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/svc-cron/type:
--------------------------------------------------------------------------------
1 | longrun
2 |
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontabs-config:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-crontabs-config
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-packt-cli-config:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/root/etc/s6-overlay/s6-rc.d/user/contents.d/init-packt-cli-config
--------------------------------------------------------------------------------
/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-cron:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GhostWriters/docker-packt-cli/056b9c6361b54281dbfb035f58dec03676c95205/root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-cron
--------------------------------------------------------------------------------
/root/opt/requirements.txt:
--------------------------------------------------------------------------------
1 | packt==1.8.10
2 |
--------------------------------------------------------------------------------
/sonar-project.properties:
--------------------------------------------------------------------------------
1 | sonar.projectKey=GhostWriters_docker-packt-cli
2 | sonar.organization=ghostwriters
3 |
4 | # This is the name and version displayed in the SonarCloud UI.
5 | #sonar.projectName=docker-packt-cli
6 | #sonar.projectVersion=1.0
7 |
8 | # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
9 | #sonar.sources=.
10 |
11 | # Encoding of the source code. Default is default system encoding
12 | #sonar.sourceEncoding=UTF-8
13 |
--------------------------------------------------------------------------------