Skip to content

Commit e55333b

Browse files
authored
initial commit: (#105)
1 parent d8eea97 commit e55333b

File tree

6 files changed

+42
-35
lines changed

6 files changed

+42
-35
lines changed

.github/workflows/ci.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ jobs:
1919
steps:
2020
- name: Checkout repository
2121
uses: actions/checkout@v4
22-
22+
- name: Set up QEMU
23+
uses: docker/setup-qemu-action@v3
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
2326
- name: Run make build
27+
env:
28+
DOCKER_BUILD_ARGS: "--platform linux/amd64,linux/arm64"
29+
DOCKER_BUILDER: "docker buildx"
2430
run: make build-${{ matrix.image }}
2531
working-directory: ./

.github/workflows/tag.yaml

+8-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,15 @@ jobs:
3636
username: ${{ github.actor }}
3737
password: ${{ secrets.GITHUB_TOKEN }}
3838

39+
- name: Set up QEMU
40+
uses: docker/setup-qemu-action@v3
41+
- name: Set up Docker Buildx
42+
uses: docker/setup-buildx-action@v3
43+
3944
- name: 'Build Images'
45+
env:
46+
DOCKER_BUILD_ARGS: "--push --platform linux/amd64,linux/arm64"
47+
DOCKER_BUILDER: "docker buildx"
4048
run: |
4149
# if workflow_dispatch is used, use the version input
4250
if [ -n "${{ github.event.inputs.version }}" ]; then
@@ -45,7 +53,6 @@ jobs:
4553
export VERSION=$(echo "$GITHUB_REF" | cut -c12-)
4654
fi
4755
make build-${{ matrix.image }}
48-
make push-${{ matrix.image }}
4956
push-helm-chart:
5057
runs-on: ubuntu-latest
5158
permissions:

Makefile

+17-15
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ APP_IMAGE_TAG ?= $(VERSION)
1111
CONTROLLER_IMG ?= $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(CONTROLLER_IMAGE_NAME):$(CONTROLLER_IMAGE_TAG)
1212
UI_IMG ?= $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(UI_IMAGE_NAME):$(UI_IMAGE_TAG)
1313
APP_IMG ?= $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(APP_IMAGE_NAME):$(APP_IMAGE_TAG)
14+
DOCKER_BUILDER ?= docker
15+
DOCKER_BUILD_ARGS ?=
1416

1517
# Check if OPENAI_API_KEY is set
1618
check-openai-key:
@@ -43,31 +45,31 @@ controller-manifests:
4345

4446
.PHONY: build-controller
4547
build-controller: controller-manifests
46-
make -C go docker-build
48+
$(DOCKER_BUILDER) build $(DOCKER_BUILD_ARGS) -t $(CONTROLLER_IMG) -f go/Dockerfile ./go
4749

48-
.PHONY: push-controller
49-
push-controller:
50-
docker push $(CONTROLLER_IMG)
50+
.PHONY: release-controller
51+
release-controller: DOCKER_BUILD_ARGS += --push --platform linux/amd64,linux/arm64
52+
release-controller: DOCKER_BUILDER = docker buildx
53+
release-controller: build-controller
5154

5255
.PHONY: build-ui
5356
build-ui:
5457
# Build the combined UI and backend image
55-
docker build -t $(UI_IMG) -f ui/Dockerfile ./ui
56-
# Tag with latest for convenience
57-
docker tag $(UI_IMG) $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(UI_IMAGE_NAME):latest
58+
$(DOCKER_BUILDER) build $(DOCKER_BUILD_ARGS) -t $(UI_IMG) -f ui/Dockerfile ./ui
5859

59-
.PHONY: push-ui
60-
push-ui:
61-
docker push $(UI_IMG)
60+
.PHONY: release-ui
61+
release-ui: DOCKER_BUILD_ARGS += --push --platform linux/amd64,linux/arm64
62+
release-ui: DOCKER_BUILDER = docker buildx
63+
release-ui: build-ui
6264

6365
.PHONY: build-app
6466
build-app:
65-
docker build -t $(APP_IMG) -f python/Dockerfile ./python
66-
docker tag $(APP_IMG) $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(APP_IMAGE_NAME):latest
67+
$(DOCKER_BUILDER) build $(DOCKER_BUILD_ARGS) -t $(APP_IMG) -f python/Dockerfile ./python
6768

68-
.PHONY: push-app
69-
push-app:
70-
docker push $(APP_IMG)
69+
.PHONY: release-app
70+
release-app: DOCKER_BUILD_ARGS += --push --platform linux/amd64,linux/arm64
71+
release-app: DOCKER_BUILDER = docker buildx
72+
release-app: build-app
7173

7274
.PHONY: kind-load-docker-images
7375
kind-load-docker-images: build

go/Dockerfile

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Build the manager binary
2-
FROM docker.io/golang:1.23 AS builder
2+
FROM --platform=$BUILDPLATFORM golang:1.23.7-alpine AS builder
3+
4+
ARG TARGETPLATFORM
5+
ARG BUILDPLATFORM
36
ARG TARGETOS
47
ARG TARGETARCH
58

python/Dockerfile

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/astral-sh/uv:debian-slim AS final
1+
FROM ghcr.io/astral-sh/uv:0.6.4-debian-slim@sha256:40aaa04efd0074d3f07c6ad6ff922d32d0dea339c5888c1d22d7db0fa3b1e954 AS final
22

33
ENV PYTHONUNBUFFERED=1 \
44
PYTHONDONTWRITEBYTECODE=1 \
@@ -11,22 +11,11 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1111
build-essential \
1212
curl \
1313
ca-certificates \
14-
nginx \
15-
supervisor \
16-
gnupg \
17-
python3 \
18-
python3-pip \
19-
python3-venv \
20-
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
21-
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
2214
&& apt-get update \
23-
&& apt-get install -y nodejs \
2415
&& update-ca-certificates \
25-
&& rm -rf /var/lib/apt/lists/* \
26-
&& ln -sf /usr/bin/python3 /usr/bin/python
16+
&& rm -rf /var/lib/apt/lists/*
2717

28-
RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \
29-
uv --version
18+
RUN uv python install 3.12
3019

3120
# Install kubectl
3221
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \
@@ -47,7 +36,7 @@ RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/s
4736
# Create groups and users
4837
RUN groupadd -g 1002 pythongroup \
4938
&& useradd -u 1002 -g pythongroup -s /bin/bash -m python \
50-
&& mkdir -p /app/python /app/ui /run/nginx \
39+
&& mkdir -p /app/python \
5140
&& chown -R python:pythongroup /app/python
5241

5342
# Set up Python backend

ui/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18-alpine AS ui-builder
1+
FROM --platform=$BUILDPLATFORM node:18-bullseye AS ui-builder
22

33
WORKDIR /app/ui
44

@@ -11,7 +11,7 @@ RUN npm ci
1111
COPY . .
1212
RUN npm run build
1313

14-
FROM ghcr.io/astral-sh/uv:debian-slim AS final
14+
FROM ghcr.io/astral-sh/uv:0.6.4-debian-slim@sha256:40aaa04efd0074d3f07c6ad6ff922d32d0dea339c5888c1d22d7db0fa3b1e954 AS final
1515

1616
RUN apt-get update && apt-get install -y --no-install-recommends \
1717
git \

0 commit comments

Comments
 (0)