-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (25 loc) · 1.02 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -----------------------------
# Stage 1: Build the Go application
# -----------------------------
FROM golang:1.21.3-alpine AS builder
WORKDIR $GOPATH/src
# Copy all files from the current directory to the working directory in the container
COPY . .
# Bypass the default Go proxy and fetch directly from the source
ENV GOPROXY=direct
# Install 'git' and other dependencies necessary for building the application
RUN apk add --no-cache git
# Fetch and tidy up the Go module dependencies
RUN go mod tidy -x
# Compile the Go application with specific settings
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o /go/bin/grender main.go
# -----------------------------
# Stage 2: Create the final image
# -----------------------------
FROM chromedp/headless-shell:latest
# Copy the compiled binary from the builder stage to the final container
COPY --from=builder /go/bin/grender /go/bin/grender
# Expose port 8080 for the application
EXPOSE 8080
# Set the command to run when the container starts
ENTRYPOINT [ "/go/bin/grender" ]