blob: 3f42b6b00552178ad91abad4a8ef9443e41a0853 [file] [log] [blame]
# Build the frontend.
FROM node:10 as frontend
WORKDIR /app
# Install dependencies based only on package*.json for better caching.
COPY frontend/package*.json ./
RUN npm install
COPY frontend ./
RUN npm run build
# Build the backend.
FROM golang:1.13 as backend
WORKDIR /app
# Install dependencies based only on go.mod for better caching.
COPY backend/go.mod ./
RUN go mod download
COPY backend ./
RUN CGO_ENABLED=0 GOOS=linux go build -mod=readonly -v -o server
# Create the final image.
# Use alpine-glibc since C++ binaries like fidlc require glibc.
FROM frolvlad/alpine-glibc:alpine-3.11_glibc-2.30
RUN apk add --no-cache ca-certificates
COPY --from=frontend /app/dist /static
COPY --from=backend /app/server /server
COPY fuchsia /fuchsia
# Run the web server on container startup.
CMD ["/server", \
"-static", "/static", \
"-bin", "/fuchsia/bin", \
"-fidl", "/fuchsia/sdk/fidl:/fuchsia/zircon/system/fidl"]