blob: 743d2ec0c0c83317213c1b0792eb6c1af719b7b7 [file] [log] [blame]
# Build the frontend.
FROM node:10 as frontend
# Install dependencies based only on package*.json for better caching.
COPY frontend/package*.json ./
RUN npm ci
COPY frontend ./
RUN npm run build
# Build the backend.
FROM golang:1.13 as backend
# 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 deployment /deployment
# Run the web server on container startup.
CMD ["/server", \
"-static", "/static", \
"-bin", "/deployment/bin", \
"-etc", "/deployment/etc", \
"-fidl", "/deployment/fuchsia/sdk/fidl:/deployment/fuchsia/zircon:/deployment/fuchsia/zircon/system/fidl"]