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 Dec 14, 2023
1 parent 62d3165 commit 5b27db1
Showing 1 changed file with 18 additions and 25 deletions.
43 changes: 18 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# Stage 1: Build the Go application
# Stage 1: Build the Frontend
FROM node:18 AS frontend

# Set the working directory for the frontend
WORKDIR /src

# Copy the entire project
COPY . /src

# 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 /src
RUN make build-web

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

# Set the working directory for Go application
Expand All @@ -16,29 +32,6 @@ COPY . .
# Build the Go application
RUN CGO_ENABLED=0 go build -o /bin/app .

# Stage 2: Build the Frontend
FROM node:18 AS frontend

# Install serve globally
# RUN npm install -g serve

# 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

# Copy the frontend build from the frontend stage
# COPY --from=frontend /app/web /checkpointz
# RUN serve -s build -l 5555

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

Expand All @@ -53,7 +46,7 @@ RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-reco
COPY --from=builder /bin/app /checkpointz

# Copy the frontend build from the frontend stage
COPY --from=frontend /app/web/build /build
# COPY --from=frontend /app/web/build /build

# Expose port 5555
EXPOSE 5555
Expand Down

0 comments on commit 5b27db1

Please sign in to comment.