diff --git a/.github/workflows/pr-images.yml b/.github/workflows/pr-images.yml index a4f3d9d0..e572dae0 100644 --- a/.github/workflows/pr-images.yml +++ b/.github/workflows/pr-images.yml @@ -115,7 +115,7 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max - file: Containerfile + file: src/Containerfile - name: Generate GHCR artifact attestation uses: actions/attest-build-provenance@v1 @@ -137,8 +137,8 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max - file: Containerfile - + file: src/Containerfile + - name: Generate QA UI Quay artifact attestation uses: actions/attest-build-provenance@v1 with: @@ -266,7 +266,7 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max - file: Containerfile.ps + file: pathservice/Containerfile - name: Generate QA PS GHCR artifact attestation uses: actions/attest-build-provenance@v1 @@ -288,8 +288,8 @@ jobs: platforms: linux/amd64,linux/arm64 cache-from: type=gha cache-to: type=gha,mode=max - file: Containerfile.ps - + file: pathservice/Containerfile + - name: Generate QA PS Quay artifact attestation uses: actions/attest-build-provenance@v1 with: diff --git a/Containerfile.ps b/Containerfile.ps deleted file mode 100644 index cb2d8ad2..00000000 Binary files a/Containerfile.ps and /dev/null differ diff --git a/Makefile b/Makefile index c550cc57..11c7b253 100644 --- a/Makefile +++ b/Makefile @@ -47,14 +47,15 @@ yaml-lint: ## Lint yaml files $(CMD_PREFIX) yamllint -c .yamllint.yaml deploy --strict ##@ Artifacts - Command to build and publish artifacts -ui-image: Containerfile ## Build continaer image for the InstructLab UI - $(ECHO_PREFIX) printf " %-12s Containerfile\n" "[docker]" - $(CMD_PREFIX) docker build -f Containerfile -t ghcr.io/instructlab/ui/ui:$(TAG) . +ui-image: src/Containerfile ## Build container image for the InstructLab UI + $(ECHO_PREFIX) printf " %-12s src/Containerfile\n" "[docker]" + $(CMD_PREFIX) docker build -f src/Containerfile -t ghcr.io/instructlab/ui/ui:$(TAG) . $(CMD_PREFIX) docker tag ghcr.io/instructlab/ui/ui:$(TAG) ghcr.io/instructlab/ui/ui:main -ps-image: Containerfile.ps ## Build continaer image for the pathservice - $(ECHO_PREFIX) printf " %-12s Containerfile.ps\n" "[docker]" - $(CMD_PREFIX) docker build -f Containerfile.ps -t ghcr.io/instructlab/ui/pathservice:$(TAG) . + +ps-image: pathservice/Containerfile ## Build container image for the InstructLab PathService + $(ECHO_PREFIX) printf " %-12s pathservice/Containerfile\n" "[docker]" + $(CMD_PREFIX) docker build -f pathservice/Containerfile -t ghcr.io/instructlab/ui/pathservice:$(TAG) . $(CMD_PREFIX) docker tag ghcr.io/instructlab/ui/pathservice:$(TAG) ghcr.io/instructlab/ui/pathservice:main ##@ Local Dev - Local machine based deployment of the UI stack diff --git a/pathservice/Containerfile b/pathservice/Containerfile new file mode 100644 index 00000000..a352e4e2 --- /dev/null +++ b/pathservice/Containerfile @@ -0,0 +1,20 @@ +FROM registry.access.redhat.com/ubi9/go-toolset:1.22.5-1730550521 as builder + +WORKDIR /opt/app-root/src + +COPY ./pathservice ./ + +# Build the Go app +RUN go build -o bin/pathservice + +# Start a new stage from scratch +FROM registry.redhat.io/ubi9-micro@sha256:113775a4479af632fde314af652daa6a45ab3d34b59ceb76a777616131daa6bd + +# Copy the binary from the previous stage +COPY --from=builder /opt/app-root/src/bin/pathservice /pathservice + +# Expose the port 4000 to the outside world +EXPOSE 4000 + +# Command to run the executable +CMD ["/pathservice"] diff --git a/Containerfile b/src/Containerfile similarity index 52% rename from Containerfile rename to src/Containerfile index 75be26e1..09fb50b6 100644 --- a/Containerfile +++ b/src/Containerfile @@ -1,6 +1,6 @@ -FROM node:22-alpine +FROM registry.access.redhat.com/ubi9/nodejs-22:9.5-1730543890 -WORKDIR /app +WORKDIR /opt/app-root/src COPY package*.json ./ RUN npm install