Skip to content

Commit

Permalink
build docker properly
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Apr 13, 2021
1 parent bff3ddc commit 18cbbcf
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ ARG GO_VERSION=1.16
FROM golang:${GO_VERSION}-alpine AS builder

# Git is required for fetching the dependencies.
RUN go env -w GOPROXY=direct
RUN apk add --no-cache git
RUN apk add ca-certificates

Expand All @@ -15,13 +14,13 @@ WORKDIR /src
# Fetch dependencies first; they are less susceptible to change on every build
# and will therefore be cached for speeding up the next build
COPY ./go.mod ./go.sum ./
RUN go mod download
RUN GO111MODULE=on go mod download

# Import the code from the context.
COPY ./ ./

# Build the executable to `/app`. Mark the build as statically linked.
RUN CGO_ENABLED=0 go build \
RUN GO111MODULE=on CGO_ENABLED=0 go build \
-installsuffix 'static' \
-o /app .

Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,13 @@ protos:
proto/faucet/faucet.proto
protoc -Iproto --go_out=proto --go_opt=paths=source_relative \
--go-grpc_out=proto --go-grpc_opt=paths=source_relative \
proto/faucet/faucet.proto
proto/faucet/faucet.proto
release:
env GOOS=darwin GOARCH=amd64 go build -o ./dist/faucet-v1.0.1-darwin-amd64 .
env GOOS=windows GOARCH=amd64 go build -o ./dist/faucet-v1.0.1-windows-amd64 .
env GOOS=linux GOARCH=amd64 go build -o ./dist/faucet-v1.0.1-linux-amd64 .
env GOOS=linux GOARCH=arm64 go build -o ./dist/faucet-v1.0.1-linux-amd64 .
shasum ./dist/faucet-v1.0.1-windows-amd64 > ./dist/faucet-v1.0.1-darwin-amd64.sha256
shasum ./dist/faucet-v1.0.1-darwin-amd64 > ./dist/faucet-v1.0.1-darwin-amd64.sha256
shasum ./dist/faucet-v1.0.1-linux-amd64 > ./dist/faucet-v1.0.1-darwin-amd64.sha256
shasum ./dist/faucet-v1.0.1-darwin-arm64 > ./dist/faucet-v1.0.1-darwin-arm64.sha256
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/prestonvanloon/go-recaptcha v0.0.0-20190217191114-0834cef6e8bd
github.com/rauljordan/minimal-grpc-gateway v0.0.0-20201017192135-199fa853d2e0
github.com/sirupsen/logrus v1.7.0
github.com/spf13/afero v1.1.2 // indirect
github.com/spf13/cobra v1.1.3
github.com/spf13/viper v1.7.1
google.golang.org/genproto v0.0.0-20201015140912-32ed001d685c
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d h1:1aflnvSoWWLI2k/dMUAl5lvU1YO4Mb4hz0gh+1rjcxU=
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -683,6 +684,7 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down

0 comments on commit 18cbbcf

Please sign in to comment.