-
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
1 parent
465114a
commit 5f38483
Showing
2 changed files
with
13 additions
and
10 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
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,27 +1,30 @@ | ||
# Stage 1: Build the Go binary | ||
FROM golang:1.22.3 AS builder | ||
FROM golang:1.20 AS builder | ||
|
||
WORKDIR /app | ||
|
||
LABEL maintainer="Abdeali Jaroli <[email protected]>" | ||
|
||
# Copy go mod and sum files | ||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
# Copy source files | ||
COPY . . | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -o jaro . | ||
# Build the Go binary | ||
RUN go build -o jaro | ||
|
||
# Stage 2: Create a lightweight image to run the binary | ||
# Create a minimal image for running the Go binary | ||
FROM alpine:latest | ||
|
||
WORKDIR /root/ | ||
|
||
# Copy the Go binary from the builder stage | ||
COPY --from=builder /app/jaro . | ||
|
||
ENV DB_URL="add-your-own-db-url" | ||
# Copy the web files into the image | ||
COPY web /root/web | ||
|
||
# Expose port 8008 | ||
EXPOSE 8008 | ||
|
||
CMD ["/root/jaro"] | ||
# Run the Go binary | ||
CMD ["./jaro"] |