towerops/k8s/base-image/QUICKSTART.md
Graham McIntire d92443d91b
feat: add podman support and Docker Hub push to base image builder
Enhanced base image build system with:

Container Engine Support:
- Auto-detect podman or docker (prefers podman if both installed)
- All scripts work with either engine seamlessly
- No configuration needed

Docker Hub Integration:
- Push to both GitLab and Docker Hub registries
- GitLab: registry.gitlab.com/towerops/towerops/elixir-runtime
- Docker Hub: docker.io/gmcintire/elixir-runtime
- Both versioned and :latest tags pushed to each

Build Script:
- Detect and use $CONTAINER_CMD for all operations
- Show which container engine is being used in output
- Tag and push to both registries automatically

Makefile:
- Add CONTAINER_CMD variable with auto-detection
- Add DOCKERHUB_REGISTRY configuration
- Update all targets to use detected container engine
- Add login-dockerhub target for Docker Hub authentication
- Update push target to push to both registries

Documentation:
- Document podman/docker auto-detection
- Update login instructions for both registries
- Update troubleshooting with examples for both engines

This makes the build system more flexible and accessible to users
who prefer podman over docker, while also publishing to the public
Docker Hub registry for easier access.
2026-01-25 09:18:03 -06:00

105 lines
2.1 KiB
Markdown

# Quick Start Guide
## One-Time Setup
Works with both **Podman** and **Docker** - the scripts auto-detect which one you have installed.
```bash
cd k8s/base-image
# Login to registries
make login # GitLab registry
make login-dockerhub # Docker Hub
# Build the base image
make build
# Test it works
make test
# Push to both registries
make push
```
## Update Main Dockerfile
Edit `k8s/Dockerfile`:
```dockerfile
# Change this line:
ARG RUNNER_IMAGE="docker.io/debian:${DEBIAN_VERSION}"
# To this:
ARG RUNNER_IMAGE="registry.gitlab.com/towerops/towerops/elixir-runtime:28.3-elixir-1.19.5-debian-trixie"
```
Remove these lines (already in base image):
```dockerfile
# DELETE THESE:
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
libstdc++6 openssl libncurses6 locales ca-certificates iputils-ping \
&& rm -rf /var/lib/apt/lists/*
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8
WORKDIR "/app"
RUN chown nobody /app
```
## Weekly/Monthly Maintenance
```bash
# Rebuild with latest security updates
cd k8s/base-image
make update
make push
```
## Common Commands
```bash
make help # Show all commands
make build # Build base image
make test # Test base image
make push # Push to registry
make inspect # Show image details
make clean # Remove local images
```
## Expected Results
- **Build time**: 2-3 minutes (first time)
- **Image size**: ~150-200 MB
- **CI/CD speedup**: 30-60 seconds saved per build
## Troubleshooting
**Build fails:**
```bash
# Try with verbose output (use podman or docker)
podman build --progress=plain --no-cache -f Dockerfile .
# or
docker build --progress=plain --no-cache -f Dockerfile .
```
**Can't push to registry:**
```bash
# Re-login
make login
make login-dockerhub
```
**Application crashes with missing library:**
```bash
# Add to Dockerfile, then rebuild
RUN apt-get install -y your-package
make build && make push
```