diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..cdf52f9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:1.11-alpine AS build-env +RUN apk --no-cache add git +ADD authserver /go/src/app +RUN cd /go/src/app && go get -v +RUN cd /go/src/app && go build -o goapp + +# final stage +FROM alpine +WORKDIR /app +COPY --from=build-env /go/src/app /app/ +ENTRYPOINT ./goapp \ No newline at end of file diff --git a/authserver/main.go b/authserver/main.go index 9086ec1..b7ddf49 100644 --- a/authserver/main.go +++ b/authserver/main.go @@ -4,6 +4,7 @@ import ( "fmt" "strings" "time" + "os" cmAuth "github.com/chartmuseum/auth" "github.com/gin-gonic/gin" @@ -13,7 +14,7 @@ var ( tokenGenerator *cmAuth.TokenGenerator tokenExpiry = time.Minute * 5 requiredGrantType = "client_credentials" - masterAccessKey = "MASTERKEY" + masterAccessKey = os.Getenv("AUTH_SERVER_MASTER_KEY") ) func oauthTokenHandler(c *gin.Context) { @@ -55,7 +56,7 @@ func oauthTokenHandler(c *gin.Context) { func main() { var err error tokenGenerator, err = cmAuth.NewTokenGenerator(&cmAuth.TokenGeneratorOptions{ - PrivateKeyPath: "../config/server.key", + PrivateKeyPath: "./config/server.key", }) if err != nil { panic(err) diff --git a/charts/org1/repo1/mychart-0.1.0.tgz b/charts/org1/repo1/mychart-0.1.0.tgz deleted file mode 100644 index 53f6dbd..0000000 Binary files a/charts/org1/repo1/mychart-0.1.0.tgz and /dev/null differ diff --git a/charts/org2/repo2/otherchart-0.1.0.tgz b/charts/org2/repo2/otherchart-0.1.0.tgz deleted file mode 100644 index a4a98d5..0000000 Binary files a/charts/org2/repo2/otherchart-0.1.0.tgz and /dev/null differ diff --git a/docker-compose.yml b/docker-compose.yml index 3b4d1fb..dd120d0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,8 @@ services: ports: - "5001:5001" command: "go run main.go" + environment: + - "AUTH_SERVER_MASTER_KEY=mypassword" working_dir: "/go/src/github.com/chartmuseum/auth-server-example/authserver" volumes: - "./authserver:/go/src/github.com/chartmuseum/auth-server-example/authserver:ro" @@ -26,5 +28,4 @@ services: - "AUTH_SERVICE=localhost:5001" - "AUTH_CERT_PATH=/config/server.pem" volumes: - - "./config:/config:ro" - - "./charts:/charts:rw" + - "./config:/config:ro" \ No newline at end of file