Skip to content

Commit 3de7a76

Browse files
author
Liav Weiss (EXT-Nokia)
committed
feat(ws): Properly containerize backend component #323
Signed-off-by: Liav Weiss (EXT-Nokia) <[email protected]>
1 parent a89a08e commit 3de7a76

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

workspaces/backend/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ WORKDIR /workspace
88
# Copy the Go Modules manifests
99
COPY backend/go.mod backend/go.sum ./
1010

11-
# Copy controller directory and rewrite the go.mod to update the replace directive
11+
# Copy controller directory
1212
COPY controller /workspace/controller
13-
RUN go mod edit -replace=github.com/kubeflow/notebooks/workspaces/controller=./controller
1413

15-
# Download dependencies
16-
RUN go mod download
14+
# Rewrite the go.mod to update the replace directive and download dependencies
15+
RUN go mod edit -replace=github.com/kubeflow/notebooks/workspaces/controller=./controller && \
16+
go mod download
1717

1818
# Copy the go source files
1919
COPY backend/cmd/ cmd/

workspaces/backend/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ run: fmt vet swag ## Run a backend from your host.
8888

8989
# If you wish to build the manager image targeting other platforms you can use the --platform flag.
9090
# (i.e. docker build --platform linux/arm64). However, you must enable docker buildKit for it.
91-
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
91+
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/11gg
9292
.PHONY: docker-build
9393
docker-build: ## Build docker image with the backend.
9494
$(CONTAINER_TOOL) build -f Dockerfile -t $(IMG) ..
@@ -108,7 +108,7 @@ PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
108108
.PHONY: docker-buildx
109109
docker-buildx: ## Build and push docker image for the manager for cross-platform support
110110
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
111-
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
111+
sed '1,// s/^FROM/FROM --platform=$${BUILDPLATFORM}/' Dockerfile > Dockerfile.cross
112112
- $(CONTAINER_TOOL) buildx create --name project-v3-builder
113113
$(CONTAINER_TOOL) buildx use project-v3-builder
114114
- $(CONTAINER_TOOL) buildx build --push --platform=$(PLATFORMS) --tag ${IMG} -f Dockerfile.cross ..

0 commit comments

Comments
 (0)