-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade and add some opinionated stuff #32
Open
alexppg
wants to merge
4
commits into
daichirata:master
Choose a base branch
from
little-angry-clouds:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,15 +1,25 @@ | ||
FROM debian:buster-slim AS build | ||
FROM golang:1.21 as builder | ||
|
||
WORKDIR /tmp | ||
ARG GCSPROXY_VERSION=0.3.1 | ||
WORKDIR /workspace | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps 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 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install --no-install-suggests --no-install-recommends --yes ca-certificates wget \ | ||
&& wget https://github.com/daichirata/gcsproxy/releases/download/v${GCSPROXY_VERSION}/gcsproxy-${GCSPROXY_VERSION}-linux-amd64.tar.gz \ | ||
&& tar zxf gcsproxy-${GCSPROXY_VERSION}-linux-amd64.tar.gz \ | ||
&& cp ./gcsproxy-${GCSPROXY_VERSION}-linux-amd64/gcsproxy . | ||
# Copy the go source | ||
COPY main.go main.go | ||
|
||
FROM gcr.io/distroless/base | ||
COPY --from=build /tmp/gcsproxy /gcsproxy | ||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o gcsproxy main.go | ||
|
||
# Use from scratch | ||
# Use distroless as minimal base image to package the gcsproxy binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot | ||
WORKDIR / | ||
COPY --from=builder /workspace/gcsproxy / | ||
USER nonroot:nonroot | ||
ENTRYPOINT ["/gcsproxy"] | ||
CMD [ "-b", "0.0.0.0:80" ] |
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
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 |
---|---|---|
@@ -1,31 +1,44 @@ | ||
module github.com/daichirata/gcsproxy | ||
|
||
go 1.18 | ||
go 1.21 | ||
|
||
require ( | ||
cloud.google.com/go/storage v1.25.0 | ||
github.com/gorilla/mux v1.8.0 | ||
google.golang.org/api v0.94.0 | ||
cloud.google.com/go/storage v1.37.0 | ||
github.com/gorilla/mux v1.8.1 | ||
google.golang.org/api v0.160.0 | ||
) | ||
|
||
require ( | ||
cloud.google.com/go v0.102.1 // indirect | ||
cloud.google.com/go/compute v1.7.0 // indirect | ||
cloud.google.com/go/iam v0.3.0 // indirect | ||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect | ||
github.com/golang/protobuf v1.5.2 // indirect | ||
github.com/google/go-cmp v0.5.8 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect | ||
github.com/googleapis/gax-go/v2 v2.4.0 // indirect | ||
go.opencensus.io v0.23.0 // indirect | ||
golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e // indirect | ||
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 // indirect | ||
golang.org/x/sys v0.0.0-20220624220833-87e55d714810 // indirect | ||
golang.org/x/text v0.3.7 // indirect | ||
golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect | ||
google.golang.org/appengine v1.6.7 // indirect | ||
google.golang.org/genproto v0.0.0-20220720214146-176da50484ac // indirect | ||
google.golang.org/grpc v1.48.0 // indirect | ||
google.golang.org/protobuf v1.28.0 // indirect | ||
cloud.google.com/go v0.112.0 // indirect | ||
cloud.google.com/go/compute v1.23.3 // indirect | ||
cloud.google.com/go/compute/metadata v0.2.3 // indirect | ||
cloud.google.com/go/iam v1.1.5 // indirect | ||
github.com/felixge/httpsnoop v1.0.4 // indirect | ||
github.com/go-logr/logr v1.4.1 // indirect | ||
github.com/go-logr/stdr v1.2.2 // indirect | ||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/google/s2a-go v0.1.7 // indirect | ||
github.com/google/uuid v1.6.0 // indirect | ||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect | ||
github.com/googleapis/gax-go/v2 v2.12.0 // indirect | ||
go.opencensus.io v0.24.0 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect | ||
go.opentelemetry.io/otel v1.22.0 // indirect | ||
go.opentelemetry.io/otel/metric v1.22.0 // indirect | ||
go.opentelemetry.io/otel/trace v1.22.0 // indirect | ||
golang.org/x/crypto v0.18.0 // indirect | ||
golang.org/x/net v0.20.0 // indirect | ||
golang.org/x/oauth2 v0.16.0 // indirect | ||
golang.org/x/sync v0.6.0 // indirect | ||
golang.org/x/sys v0.16.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
golang.org/x/time v0.5.0 // indirect | ||
google.golang.org/appengine v1.6.8 // indirect | ||
google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect | ||
google.golang.org/grpc v1.61.0 // indirect | ||
google.golang.org/protobuf v1.32.0 // indirect | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for the improvements to the Docker files!
I agree with the use of distroless images, but I think it would be less problematic and more beneficial to download binaries generated by github actions rather than have users build the executables themselves, which would speed up the image generation. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I agree, I'll change ASAP.