- Shell 63.9%
- Dockerfile 36.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
## Summary A focused set of code-quality and documentation fixes for `docker-tftp`. All changes are backwards compatible — the container behaves the same; the diff is just hardening, cleanup and missing/incorrect pieces. ### Dockerfile - Added `# syntax=docker/dockerfile:1.7` so `COPY --chmod` is reliably supported on any builder. - Switched `COPY` + `RUN chmod +x` to a single `COPY --chmod=0755 start.sh init.sh /`. - Dropped the redundant `WORKDIR /` and switched the entrypoint to the absolute path `/start.sh`. - Replaced the old-style `LABEL maintainer` / `LABEL description` with the OCI-recommended `org.opencontainers.image.*` labels (title, description, source, licenses, authors) so the image is properly described by registries and tools. - Hardened `HEALTHCHECK`: it now fails when either the `dnsmasq` process is missing **or** UDP port 69 is unreachable, using a bounded `nc -u -z -w 2` check (the previous check relied on busybox `nc -z -u` which is unreliable for UDP across busybox versions). ### init.sh - Added `set -euo pipefail` so the script aborts on the first failure instead of starting dnsmasq in a half-configured state. - Added an explicit `mkdir -p "$TFTP_HOME"` before `chown`/`chmod`. Previously, if `/tftp` was removed on the host between container runs, the script failed with a confusing error. - Parameterised the tftp home directory (`TFTP_HOME`, default `/tftp`) and tightened the variable quoting. ### start.sh - Added `set -euo pipefail` so `/init.sh` failures abort the container instead of being logged-and-ignored by the previous `[ $? -ne 0 ]` check (now simplified away). - Fixed the header comment, which previously read "Init File" while the script actually runs dnsmasq. - Reformatted the dnsmasq options onto separate lines for readability. ### .woodpecker.yml - Removed the redundant `when: branch: main / event: push` block on the `security-scan` step (already inherited from the top-level `when:`). - Added a `lint` step running `hadolint` against the Dockerfile, matching what the CHANGELOG already promised but had never been wired up. ### README.md - Fixed the broken numbered list under "Quick Deployment": it previously started at `3.` with steps 1-2 missing. - Restructured the section to read as prose with a code block, which is what the original single-step `docker run` really was. ### CHANGELOG.md - Merged the two `### Changed` sections into one (a duplicate heading had been left in an earlier revision). - Added entries describing all the improvements in this PR. ### .gitignore - Added entries for OS files (`.DS_Store`, `Thumbs.db`), editor backups (`*~`, `*.swp`, `*.swo`) and `*.log`. ### Notes - No changes to the `ALPINE_VERSION` ARG - Renovate already has an open PR (#5) bumping it to 3.24.1; this PR deliberately leaves that to the bot to avoid a merge conflict. - No changes to `renovate.json` - it already works via the instance-level config. ### Testing - Both shell scripts pass `bash -n` syntax check. - The Dockerfile follows the Hadolint baseline (syntax directive, no `latest` without a digest, only the packages actually needed, single-purpose `RUN`, `COPY --chmod` instead of separate `chmod`, etc.) - the CI lint step will be the source of truth. --- This change was produced by an AI assistant on behalf of the repository owner. Reviewed-on: #6 |
||
| .gitignore | ||
| .woodpecker.yml | ||
| CHANGELOG.md | ||
| Dockerfile | ||
| init.sh | ||
| LICENSE | ||
| README.md | ||
| renovate.json | ||
| start.sh | ||
docker-tftp
Simple & slim TFTP server using dnsmasq, containerized for easy deployment and management.
Overview
This project provides a lightweight, containerized TFTP (Trivial File Transfer Protocol) server using dnsmasq as the backend. It's designed for simplicity, security, and ease of deployment in various environments.
Features
- Containerized Deployment: Easy deployment using Docker with minimal dependencies
- Security Focused: Runs with minimal privileges and includes security features like tftp-secure
- Cross-Platform: Works on any system that supports Docker
- Easy Configuration: Simple environment variables for customization
- Health Monitoring: Built-in healthcheck for container orchestration systems
Quick Start
Prerequisites
- Docker or compatible container runtime
- Basic understanding of TFTP protocol
Quick Deployment
Run the container with the following command:
docker run -d \
--name tftp-server \
-p 69:69/udp \
-v /path/to/your/tftp-folder:/tftp \
git.hackmi.ch/phil/docker-tftp:latest
Configuration
Environment Variables
The following environment variables can be set to customize the container:
PUID(default: 1000): User ID for the tftp processPGID(default: 1000): Group ID for the tftp processTFTP_ROOT: Root directory for TFTP operations (default: /tftp)
Volume Mounting
For persistent storage and file sharing, mount your desired directory to /tftp in the container.
Advanced Usage
Custom Configuration
You can customize the dnsmasq configuration by creating a custom config file and mounting it to /etc/dnsmasq.conf in the container.
Health Checking
The container includes a healthcheck that verifies the TFTP service is responsive on port 69.
Integration Tests
The project includes test scripts to validate functionality in CI/CD pipelines.
Building from Source
- Clone the repository:
git clone https://git.hackmi.ch/phil/docker-tftp.git - Build the image:
docker build -t docker-tftp . - Test locally: Use the quick start instructions above
License
This project is licensed under the MIT License. See the LICENSE file for details.