-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a Dockerfile and build process for Google Cloud Run deployment. Edits the configuration for the current and correct production environment.
- Loading branch information
Showing
9 changed files
with
116 additions
and
35 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,14 @@ | ||
# The .dockerignore file excludes files from the container build process. | ||
# | ||
# https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
|
||
# Exclude locally vendored dependencies. | ||
vendor/ | ||
|
||
# Exclude "build-time" ignore files. | ||
.dockerignore | ||
.gcloudignore | ||
|
||
# Exclude git history and configuration. | ||
.git | ||
.gitignore |
Empty file.
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 |
---|---|---|
|
@@ -15,4 +15,7 @@ | |
# vendor/ | ||
|
||
# Environment variables | ||
.env | ||
.env | ||
|
||
# Fixtures and data | ||
fixtures/ |
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,42 @@ | ||
# Use the offical golang image to create a binary. | ||
# This is based on Debian and sets the GOPATH to /go. | ||
# https://hub.docker.com/_/golang | ||
FROM golang:1.16-buster as builder | ||
|
||
# Create and change to the app directory. | ||
WORKDIR /app | ||
|
||
# Retrieve application dependencies. | ||
# This allows the container build to reuse cached dependencies. | ||
# Expecting to copy go.mod and if present go.sum. | ||
COPY go.* ./ | ||
RUN go mod download | ||
|
||
# Copy local code to the container image. | ||
COPY . ./ | ||
|
||
# Build the binary. | ||
RUN go build -v ./cmd/whisper | ||
|
||
# Use the official Debian slim image for a lean production container. | ||
# https://hub.docker.com/_/debian | ||
FROM debian:buster-slim | ||
|
||
LABEL maintainer="Rotational Labs <info@rotational.io>" | ||
LABEL description="Whisper, a secret management utility" | ||
|
||
RUN set -x && apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the binary to the production image from the builder stage. | ||
COPY --from=builder /app/whisper /app/whisper | ||
|
||
# Production environment defaults | ||
ENV WHISPER_MAINTENANCE=false | ||
ENV WHISPER_MODE=release | ||
ENV WHISPER_LOG_LEVEL=info | ||
ENV WHISPER_CONSOLE_LOG=false | ||
|
||
# Run the web service on container startup. | ||
CMD ["/app/whisper", "serve"] |
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
Empty file.
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
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