26 lines
613 B
Docker
26 lines
613 B
Docker
|
# Build React frontend
|
||
|
# Stage 1: Install dependencies
|
||
|
FROM node:14 AS fe-builder
|
||
|
WORKDIR /app
|
||
|
# Copy package.json and package-lock.json first to leverage caching
|
||
|
COPY boxes-fe/package*.json ./
|
||
|
# Install dependencies
|
||
|
RUN npm install
|
||
|
# Copy the rest of your application code
|
||
|
COPY boxes-fe/.env .
|
||
|
COPY boxes-fe/. .
|
||
|
# Build the application
|
||
|
RUN npm run build
|
||
|
|
||
|
# next stage
|
||
|
FROM golang:latest
|
||
|
WORKDIR /app
|
||
|
COPY boxes-api/go.mod ./
|
||
|
COPY boxes-api/go.sum ./
|
||
|
RUN go mod download
|
||
|
COPY boxes-api/. ./
|
||
|
ENV CGO_ENABLED=1
|
||
|
RUN go build -o boxes-api .
|
||
|
COPY --from=fe-builder /app/build /app/build
|
||
|
EXPOSE 8080
|
||
|
CMD ["./boxes-api"]
|