Skip to content

Commit dd1f42e

Browse files
atifatheratif
authored and
atif
committed
Update Dockerfile
Signed-off-by: Atif Ather <[email protected]>
1 parent 88bb31e commit dd1f42e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,55 @@
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
118
FROM golang:1.20 AS builder
19+
20+
# Set the working directory for Go application
221
WORKDIR /src
22+
23+
# Copy Go modules files
324
COPY go.sum go.mod ./
25+
26+
# Download Go modules
427
RUN go mod download
28+
29+
# Copy the entire project
530
COPY . .
31+
32+
# Move frontend files to the root
33+
COPY --from=frontend /app/web ./web
34+
35+
# Build the Go application
636
RUN CGO_ENABLED=0 go build -o /bin/app .
737

38+
# Stage 3: Create the final image
839
FROM ubuntu:latest
40+
41+
# Install dependencies for the final image
942
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
1043
libssl-dev \
1144
ca-certificates \
1245
&& apt-get clean \
1346
&& rm -rf /var/lib/apt/lists/*
47+
48+
# Copy the Go binary from the builder stage
1449
COPY --from=builder /bin/app /checkpointz
50+
51+
# Expose port 5555
1552
EXPOSE 5555
53+
54+
# Set the entrypoint for the container
1655
ENTRYPOINT ["/checkpointz"]

0 commit comments

Comments
 (0)