Skip to content

Commit

Permalink
Update Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Atif Ather <[email protected]>
  • Loading branch information
atifather authored and atif committed Dec 15, 2023
1 parent 88bb31e commit dd1f42e
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,55 @@
# Stage 1: Build the Frontend
FROM node:18.14.1 AS frontend

# Set the working directory for the frontend
WORKDIR /app

# Copy the entire project
COPY . /app

# Install make, required for the build process
RUN apt-get update && apt-get install -y make

# Change to the ./web directory and build the frontend
WORKDIR /app
RUN make build-web

# Stage 2: Build the Go application
FROM golang:1.20 AS builder

# Set the working directory for Go application
WORKDIR /src

# Copy Go modules files
COPY go.sum go.mod ./

# Download Go modules
RUN go mod download

# Copy the entire project
COPY . .

# Move frontend files to the root
COPY --from=frontend /app/web ./web

# Build the Go application
RUN CGO_ENABLED=0 go build -o /bin/app .

# Stage 3: Create the final image
FROM ubuntu:latest

# Install dependencies for the final image
RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-recommends \
libssl-dev \
ca-certificates \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Copy the Go binary from the builder stage
COPY --from=builder /bin/app /checkpointz

# Expose port 5555
EXPOSE 5555

# Set the entrypoint for the container
ENTRYPOINT ["/checkpointz"]

0 comments on commit dd1f42e

Please sign in to comment.