File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Stage 1: Build the Frontend
2
+ FROM node:18.14.1 AS frontend
3
+
4
+ # Set the working directory for the frontend
5
+ WORKDIR /app
6
+
7
+ # Copy the entire project
8
+ COPY . /app
9
+
10
+ # Install make, required for the build process
11
+ RUN apt-get update && apt-get install -y make
12
+
13
+ # Change to the ./web directory and build the frontend
14
+ WORKDIR /app
15
+ RUN make build-web
16
+
17
+ # Stage 2: Build the Go application
1
18
FROM golang:1.20 AS builder
19
+
20
+ # Set the working directory for Go application
2
21
WORKDIR /src
22
+
23
+ # Copy Go modules files
3
24
COPY go.sum go.mod ./
25
+
26
+ # Download Go modules
4
27
RUN go mod download
28
+
29
+ # Copy the entire project
5
30
COPY . .
31
+
32
+ # Move frontend files to the root
33
+ COPY --from=frontend /app/web ./web
34
+
35
+ # Build the Go application
6
36
RUN CGO_ENABLED=0 go build -o /bin/app .
7
37
38
+ # Stage 3: Create the final image
8
39
FROM ubuntu:latest
40
+
41
+ # Install dependencies for the final image
9
42
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
10
43
libssl-dev \
11
44
ca-certificates \
12
45
&& apt-get clean \
13
46
&& rm -rf /var/lib/apt/lists/*
47
+
48
+ # Copy the Go binary from the builder stage
14
49
COPY --from=builder /bin/app /checkpointz
50
+
51
+ # Expose port 5555
15
52
EXPOSE 5555
53
+
54
+ # Set the entrypoint for the container
16
55
ENTRYPOINT ["/checkpointz" ]
You can’t perform that action at this time.
0 commit comments