-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor code to handle case when API key is not provided
- Loading branch information
1 parent
c003a33
commit 13a93e0
Showing
3 changed files
with
24 additions
and
21 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 |
---|---|---|
@@ -1,32 +1,27 @@ | ||
# Use the official Go image | ||
FROM golang:1.19 AS build | ||
# Use the official Golang image to create a build artifact. | ||
FROM golang:1.19 as builder | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
|
||
# Download dependencies | ||
RUN go mod download | ||
|
||
# Copy source code | ||
# Copy the source code | ||
COPY . . | ||
|
||
# Build the application | ||
RUN go build -o main . | ||
# Build | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /app/main . | ||
|
||
# Use a lightweight image for deployment | ||
FROM alpine:latest AS runtime | ||
# Use a minimal image for deployment | ||
FROM alpine:latest | ||
|
||
# Install necessary libraries | ||
RUN apk --no-cache add ca-certificates | ||
# Copy the binary | ||
COPY --from=builder /app/main /app/main | ||
|
||
# Copy binary | ||
COPY --from=build /app/main /app/ | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Run the application | ||
CMD [". --download-only"] | ||
# This is the entry point, specify your flags here | ||
ENTRYPOINT [ "/app/main", "--download-only" ] |
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