-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mateusz Urbanek <[email protected]>
- Loading branch information
1 parent
7b34cad
commit 6b6cbd5
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Binaries for programs and plugins | ||
bin/ | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
# Helm resources | ||
helm/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Copyright 2023 Linode, LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG TOOLCHAIN_VERSION=1.21 | ||
|
||
######################################################################################### | ||
# Build | ||
######################################################################################### | ||
|
||
# First stage: building the driver executable. | ||
FROM docker.io/library/golang:${TOOLCHAIN_VERSION} as builder | ||
|
||
WORKDIR /work | ||
|
||
# Copy the Go Modules manifests. | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
|
||
# Cache dep before building and copying source so that we don't need to re-download as | ||
# much and so that source changes don't invalidate our downloaded layer. | ||
RUN go mod download | ||
|
||
# Copy the go source. | ||
COPY cmd/ cmd/ | ||
COPY internal/ internal/ | ||
COPY pkg/ pkg/ | ||
COPY Makefile Makefile | ||
|
||
# Explicitly set the version, so the make won't try to get it (and fail). | ||
ENV VERSION="builder" | ||
|
||
# Build. | ||
RUN make build | ||
|
||
######################################################################################### | ||
# Runtime | ||
######################################################################################### | ||
|
||
# Second stage: building final environment for running the executable. | ||
FROM gcr.io/distroless/static-debian11:latest AS runtime | ||
|
||
COPY --from=builder /work/bin/linode-cosi-driver /usr/bin/linode-cosi-driver | ||
|
||
# Set volume mount point for app socket. | ||
VOLUME [ "/var/lib/cosi" ] | ||
|
||
# Disable healthcheck. | ||
HEALTHCHECK NONE | ||
|
||
# Add labels | ||
LABEL name="linode-cosi-driver" | ||
LABEL description="COSI Driver for Linode Object Storage" | ||
LABEL vendor="Linode, LLC" | ||
LABEL license="Apache-2.0" | ||
LABEL maintainers="Linode COSI Driver Authors" | ||
|
||
# Set the entrypoint. | ||
ENTRYPOINT [ "/usr/bin/linode-cosi-driver" ] | ||
CMD [] |