Skip to content

Default to Podman, allow Docker optionally #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion applications/wg-easy/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ vars:
GCP_ZONE: '{{.GCP_ZONE | default "us-central1-a"}}'
VM_NAME: '{{.VM_NAME | default (printf "%s-dev" (or (env "GUSER") "user"))}}'

# Docker workflow configuration
# Container workflow configuration
IMAGE_NAME: ttl.sh/wg-easy-dev
CONTAINER_NAME: wg-easy-dev
CONTAINER_RUNTIME: '{{.CONTAINER_RUNTIME | default "podman"}}'

tasks:
default:
Expand Down
4 changes: 2 additions & 2 deletions applications/wg-easy/container/Containerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base image for all shared Dockerfiles for taskfiles
# Use this image as base image for app specific docker files
# Base image for all shared Containerfiles for taskfiles
# Use this image as base image for app specific container files
FROM --platform=$BUILDPLATFORM ubuntu:24.04

ARG TARGETOS
Expand Down
4 changes: 2 additions & 2 deletions applications/wg-easy/docs/development-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ The core philosophy of this workflow is to start simple and add complexity incre
Before starting the development workflow, ensure you have the following tools installed:

- **Task:** The task runner used in this project. ([Installation Guide](https://taskfile.dev/installation/))
- **Docker:** Container runtime for local development. ([Installation Guide](https://docs.docker.com/get-docker/))
- **Container runtime tool** Either [Podman](https://podman.io/docs/installation) (default) or [Docker](https://docs.docker.com/get-docker/) for local development

All other tools will be automatically provided through task commands and Docker containers.
All other tools will be automatically provided through task commands and containers.

## Workflow Stages

Expand Down
14 changes: 7 additions & 7 deletions applications/wg-easy/taskfiles/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: "3"
# Development environment tasks
tasks:
build-image:
desc: Build development Docker image
desc: Build development container image
vars:
IMAGE_NAME: '{{.IMAGE_NAME}}'
IMAGE_TAG: '{{.IMAGE_TAG | default "latest"}}'
Expand All @@ -13,7 +13,7 @@ tasks:
vars: [IMAGE_NAME, IMAGE_TAG, CONTAINERFILE]

cmds:
- docker build -t {{.IMAGE_NAME}} -f {{.CONTAINERFILE}} .
- '{{.CONTAINER_RUNTIME}} build -t {{.IMAGE_NAME}} -f {{.CONTAINERFILE}} .'

start:
desc: Start development container in background
Expand All @@ -36,11 +36,11 @@ tasks:
vars: [IMAGE_NAME, CONTAINER_NAME, REPLICATED_API_TOKEN]

status:
- docker ps | grep -q "{{.CONTAINER_NAME}}"
- '{{.CONTAINER_RUNTIME}} ps | grep -q "{{.CONTAINER_NAME}}"'
cmds:
- |
# Start container with host networking for kubectl port-forward compatibility
CONTAINER_ID=$(docker run --rm --name {{.CONTAINER_NAME}} -d \
CONTAINER_ID=$({{.CONTAINER_RUNTIME}} run --rm --name {{.CONTAINER_NAME}} -d \
-v $(pwd):/workspace \
-e HOME=/home/devuser \
-e USER=devuser \
Expand All @@ -64,7 +64,7 @@ tasks:
- start-implementation
cmds:
- echo "Connecting to {{.CONTAINER_NAME}}..."
- docker exec -it {{.CONTAINER_NAME}} /bin/bash
- '{{.CONTAINER_RUNTIME}} exec -it {{.CONTAINER_NAME}} /bin/bash'

stop:
desc: Stop development container
Expand All @@ -73,9 +73,9 @@ tasks:
vars: [CONTAINER_NAME]
cmds:
- |
if docker ps | grep -q "{{.CONTAINER_NAME}}"; then
if {{.CONTAINER_RUNTIME}} ps | grep -q "{{.CONTAINER_NAME}}"; then
echo "Stopping {{.CONTAINER_NAME}} development container..."
docker stop {{.CONTAINER_NAME}}
{{.CONTAINER_RUNTIME}} stop {{.CONTAINER_NAME}}
else
echo "Container {{.CONTAINER_NAME}} is not running"
fi
Expand Down