-
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.
- Loading branch information
Showing
1 changed file
with
24 additions
and
7 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,17 +1,34 @@ | ||
FROM 533267185808.dkr.ecr.us-west-2.amazonaws.com/docker.io/central/library/golang:1.22-alpine AS builder | ||
# Builder Stage | ||
FROM docker.io/library/golang:1.22-alpine AS builder | ||
WORKDIR /app | ||
|
||
# Build argument for the image tag (if required) | ||
ARG IMAGE_TAG | ||
|
||
RUN apk update | ||
RUN apk --update add --no-cache git tzdata | ||
ADD . . | ||
# Install dependencies for building the app | ||
RUN apk add --no-cache git tzdata | ||
|
||
# Copy source code into the container | ||
COPY . . | ||
|
||
# Build the Go binary | ||
RUN GOPROXY=direct go build -o api . | ||
|
||
FROM 533267185808.dkr.ecr.us-west-2.amazonaws.com/docker.io/central/library/alpine:3 | ||
# Final Stage | ||
FROM docker.io/library/alpine:3 | ||
WORKDIR /app | ||
RUN apk update && apk upgrade && apk --no-cache add curl | ||
|
||
# Install runtime dependencies | ||
RUN apk add --no-cache curl | ||
|
||
# Copy the built binary from the builder stage | ||
COPY --from=builder /app/api /app/ | ||
|
||
# Ensure the binary is executable | ||
RUN chmod +x /app/api | ||
|
||
# Expose port 3000 for the application | ||
EXPOSE 3000 | ||
ENTRYPOINT ./api | ||
|
||
# Entry point for the container | ||
ENTRYPOINT ["/app/api"] |