Skip to content
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

feat: support podman #358

Merged
merged 1 commit into from
Mar 6, 2024
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Install Go 1.22
command: |
sudo rm -rf /usr/local/go
wget -O go.tgz https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
wget -O go.tgz https://go.dev/dl/go1.22.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go.tgz
which go
go version
Expand Down
6 changes: 6 additions & 0 deletions foundation/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ func extractIPPort(id string, port string) (hostIP string, hostPort string, err

for _, doc := range docs {
if doc.HostIP != "::" {
// Podman keeps HostIP empty instead of using 0.0.0.0.
// - https://github.com/containers/podman/issues/17780
if doc.HostIP == "" {
return "localhost", doc.HostPort, nil
}

return doc.HostIP, doc.HostPort, nil
}
}
Expand Down
22 changes: 7 additions & 15 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ SHELL = $(if $(wildcard $(SHELL_PATH)),/bin/ash,/bin/bash)
# Install Tooling and Dependencies
#
# This project uses Docker and it is expected to be installed. Please provide
# Docker at least 4 CPUs.
# Docker at least 4 CPUs. To use Podman instead please alias Docker CLI to
# Podman CLI or symlink the Docker socket to the Podman socket. More
# information on migrating from Docker to Podman can be found at
# https://podman-desktop.io/docs/migrating-from-docker.
#
# Run these commands to install everything needed.
# $ make dev-brew
Expand Down Expand Up @@ -134,7 +137,7 @@ PROMTAIL := grafana/promtail:2.9.0
KIND_CLUSTER := ardan-starter-cluster
NAMESPACE := sales-system
APP := sales
BASE_IMAGE_NAME := ardanlabs/service
BASE_IMAGE_NAME := localhost/ardanlabs/service
SERVICE_NAME := sales-api
VERSION := 0.0.1
SERVICE_IMAGE := $(BASE_IMAGE_NAME)/$(SERVICE_NAME):$(VERSION)
Expand Down Expand Up @@ -181,15 +184,15 @@ service:
-f zarf/docker/dockerfile.service \
-t $(SERVICE_IMAGE) \
--build-arg BUILD_REF=$(VERSION) \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
.

metrics:
docker build \
-f zarf/docker/dockerfile.metrics \
-t $(METRICS_IMAGE) \
--build-arg BUILD_REF=$(VERSION) \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") \
.

# ==============================================================================
Expand Down Expand Up @@ -227,17 +230,6 @@ dev-load:
kind load docker-image $(SERVICE_IMAGE) --name $(KIND_CLUSTER)
kind load docker-image $(METRICS_IMAGE) --name $(KIND_CLUSTER)

# podman is currently experimental, and fails for some reason with kind load
# docker-image (possibly a tagging issue?) but the below works.
dev-load-podman:
docker image save $(SERVICE_IMAGE):$(VERSION) -o image-sales
kind load image-archive image-sales --name ardan-starter-cluster
rm -f image-sales-metrics image-sales

rm -f image-sales-metrics image-sales
docker image save $(METRICS_IMAGE):$(VERSION) -o image-sales-metrics
kind load image-archive image-sales-metrics --name ardan-starter-cluster

dev-apply:
kustomize build zarf/k8s/dev/grafana | kubectl apply -f -
kustomize build zarf/k8s/dev/prometheus | kubectl apply -f -
Expand Down
4 changes: 2 additions & 2 deletions zarf/k8s/dev/sales/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ patches:
- path: ./dev-sales-patch-service.yaml
images:
- name: service-image
newName: ardanlabs/service/sales-api
newName: localhost/ardanlabs/service/sales-api
newTag: 0.0.1
- name: metrics-image
newName: ardanlabs/service/sales-api-metrics
newName: localhost/ardanlabs/service/sales-api-metrics
newTag: 0.0.1