Building Docker Containers
How to build Password Pusher Docker containers from source
If you want to build your own Password Pusher Docker containers—whether for alternative architectures, custom modifications, or simply to verify the build process—this guide walks you through the steps.
Prerequisites
- Docker installed
- Docker Buildx (included with Docker Desktop)
- Git for cloning the repository
Clone the Repository
git clone https://github.com/pglombardo/PasswordPusher.git
cd PasswordPusher
Available Images
Password Pusher provides three Docker images:
| Image | Dockerfile | Purpose |
|---|---|---|
pwpush |
containers/docker/Dockerfile |
Main application |
pwpush-public-gateway |
containers/docker/Dockerfile.public-gateway |
Public gateway for external push delivery |
pwpush-worker |
containers/docker/Dockerfile.worker |
Background job worker |
Note: The pwpush-public-gateway and pwpush-worker images depend on the main pwpush image, so you must build pwpush first.
Building the Main Image
Build the main Password Pusher image:
docker buildx build \
--file ./containers/docker/Dockerfile \
--tag my-pwpush:latest \
--load \
.
The --load flag loads the built image into your local Docker daemon.
Building for Specific Architectures
To build for a specific platform (e.g., ARM64 for Apple Silicon or Raspberry Pi):
docker buildx build \
--file ./containers/docker/Dockerfile \
--platform linux/arm64 \
--tag my-pwpush:latest \
--load \
.
Common platform values:
linux/amd64- Intel/AMD 64-bit (most cloud servers)linux/arm64- ARM 64-bit (Apple Silicon, AWS Graviton, Raspberry Pi 4)
Multi-Platform Builds
To build for multiple platforms simultaneously, you’ll need to push to a registry (multi-platform images can’t be loaded locally):
docker buildx build \
--file ./containers/docker/Dockerfile \
--platform linux/amd64,linux/arm64 \
--tag your-registry/pwpush:latest \
--push \
.
Tip: For multi-platform builds, you may need to create a new builder instance:
docker buildx create --name multiplatform --use
docker buildx inspect --bootstrap
Building Additional Images
After building the main image, you can build the additional images.
Public Gateway Image
The public gateway extends the main image with PWP_PUBLIC_GATEWAY=true:
# First, tag your main image as expected by the Dockerfile
docker tag my-pwpush:latest pglombardo/pwpush:latest
# Then build the public gateway
docker buildx build \
--file ./containers/docker/Dockerfile.public-gateway \
--tag my-pwpush-public-gateway:latest \
--load \
.
Worker Image
The worker image extends the main image for running background jobs:
# Ensure main image is tagged
docker tag my-pwpush:latest pglombardo/pwpush:latest
# Build the worker
docker buildx build \
--file ./containers/docker/Dockerfile.worker \
--tag my-pwpush-worker:latest \
--load \
.
Running Your Custom Build
After building, run your custom image:
docker run -d -p "80:80" -p "443:443" my-pwpush:latest
Or update your docker-compose.yml to use your custom image:
services:
pwpush:
image: my-pwpush:latest
# ... rest of configuration
Build Arguments
The Dockerfile supports these build arguments:
| Argument | Default | Description |
|---|---|---|
BUNDLE_WITHOUT |
development:test |
Ruby bundle groups to exclude |
BUNDLE_DEPLOYMENT |
true |
Enable bundle deployment mode |
UID |
1000 |
User ID for the application user |
GID |
1000 |
Group ID for the application user |
Example with custom UID/GID:
docker buildx build \
--file ./containers/docker/Dockerfile \
--build-arg UID=1001 \
--build-arg GID=1001 \
--tag my-pwpush:latest \
--load \
.
Troubleshooting
Build Cache Issues
If you encounter stale cache issues, add --no-cache:
docker buildx build --no-cache \
--file ./containers/docker/Dockerfile \
--tag my-pwpush:latest \
--load \
.
Cross-Platform Build Errors
For cross-platform builds, ensure QEMU is installed:
docker run --privileged --rm tonistiigi/binfmt --install all
Disk Space
Docker builds can consume significant disk space. Clean up unused images and build cache:
docker system prune -a
docker buildx prune
See Also
- OSS Installation - Standard installation methods
- Docker Environment File - Configure your container with environment variables
- Docker Volumes - Persistent storage configuration
- Public Gateway - Learn about the public gateway architecture