Skip to content

Commit

Permalink
rename to /app/backup-ns binary
Browse files Browse the repository at this point in the history
  • Loading branch information
majodev committed Jan 8, 2025
1 parent 7c58aae commit 8b0a143
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
19 changes: 9 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -283,26 +283,25 @@ RUN make go-build
# --- debian:buster-slim https://hub.docker.com/_/debian (if you need apt-get).
### -----------------------

# which kubectl version to install (optimally this is in sync with the k8s version in your cluster)
FROM kubectl as app
COPY --from=builder /usr/bin/jq /usr/bin/jq
WORKDIR /app

# old bash reference implementation
COPY --from=builder --chmod=0777 /app/reference/backup-ns.sh /app/backup-ns.sh
COPY --from=builder --chmod=0777 /app/reference/sync-metadata-to-vsc.sh /app/sync-metadata-to-vsc.sh
# bash reference implementation, we still use retain.sh and mark-and-delete.sh
COPY --from=builder /app/reference/lib /app/lib
# COPY --from=builder --chmod=0777 /app/reference/backup-ns.sh /app/backup-ns.sh
# COPY --from=builder --chmod=0777 /app/reference/sync-metadata-to-vsc.sh /app/sync-metadata-to-vsc.sh
COPY --from=builder --chmod=0777 /app/reference/retain.sh /app/retain.sh
COPY --from=builder --chmod=0777 /app/reference/mark-and-delete.sh /app/mark-and-delete.sh
COPY --from=builder /app/reference/lib /app/lib

# sanity check all the required bash/cli tools are installed in the image
RUN bash -c "source /app/lib/utils.sh && utils_check_host_requirements true true"

# new go binary
COPY --from=builder /app/bin/app /app/
COPY --from=builder /app/bin/backup-ns /app/

# default entrypoint is the new go binary already
ENTRYPOINT ["/app/app"]
ENTRYPOINT ["/app/backup-ns"]
CMD ["create"]

# distroless disabled for now, until we switch to the full go based version (without the above bash reference implementation)
Expand All @@ -315,11 +314,11 @@ CMD ["create"]

# # https://hub.docker.com/r/bitnami/kubectl/tags
# COPY --from=kubectl /opt/bitnami/kubectl/bin/kubectl /usr/local/bin/kubectl
# COPY --from=builder /app/bin/app /app/
# COPY --from=builder /app/bin/backup-ns /app/

# WORKDIR /app

# # Must comply to vector form
# # https://github.com/GoogleContainerTools/distroless#entrypoints
# ENTRYPOINT ["/app/app"]
# # CMD ["arg"]
# ENTRYPOINT ["/app/backup-ns"]
# CMD ["create"]
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ helm:

.PHONY: go-build
go-build: ##- (opt) Runs go build.
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/app-linux-arm64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/app-linux-amd64
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/app-darwin-arm64
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o bin/app-darwin-amd64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o bin/backup-ns-linux-arm64
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o bin/backup-ns-linux-amd64
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o bin/backup-ns-darwin-arm64
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o bin/backup-ns-darwin-amd64

CGO_ENABLED=0 go build -o bin/app
CGO_ENABLED=0 go build -o bin/backup-ns

# https://github.com/gotestyourself/gotestsum#format
# w/o cache https://github.com/golang/go/issues/24573 - see "go help testflag"
Expand Down Expand Up @@ -122,16 +122,16 @@ tidy: ##- (opt) Tidy our go.sum file.
# Got license issues with some dependencies? Provide a custom lichen --config
# see https://github.com/uw-labs/lichen#config
.PHONY: get-licenses
get-licenses: ##- Prints licenses of embedded modules in the compiled bin/app.
lichen bin/app
get-licenses: ##- Prints licenses of embedded modules in the compiled bin/backup-ns.
lichen bin/backup-ns

.PHONY: get-embedded-modules
get-embedded-modules: ##- Prints embedded modules in the compiled bin/app.
go version -m -v bin/app
get-embedded-modules: ##- Prints embedded modules in the compiled bin/backup-ns.
go version -m -v bin/backup-ns

.PHONY: get-embedded-modules-count
get-embedded-modules-count: ##- (opt) Prints count of embedded modules in the compiled bin/app.
go version -m -v bin/app | grep $$'\tdep' | wc -l
get-embedded-modules-count: ##- (opt) Prints count of embedded modules in the compiled bin/backup-ns.
go version -m -v bin/backup-ns | grep $$'\tdep' | wc -l

### -----------------------
# --- Helpers
Expand Down
4 changes: 3 additions & 1 deletion deploy/static/backup-ns-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ spec:
containers:
- image: # ghcr.io/allaboutapps/backup-ns:<tag>
name: sync-metadata-to-vsc
command: ["/app/sync-metadata-to-vsc.sh"]
command:
- /app/backup-ns
- syncMetadataToVsc
volumeMounts:
- name: timezone
mountPath: /etc/localtime
Expand Down

0 comments on commit 8b0a143

Please sign in to comment.