diff --git a/Dockerfile b/Dockerfile index 3b337b3..a947cfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 @@ -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 @@ -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