Files
nicholas 1c54ce1d92
Build and deploy / build (push) Successful in 37s
Build and deploy / deploy (push) Successful in 16s
Run tests inside container build
2026-09-08 13:03:47 -05:00

29 lines
910 B
Docker

FROM node:24-alpine AS web-build
WORKDIR /src/web
COPY web/package.json web/package-lock.json ./
RUN npm ci
COPY web/ ./
RUN npm run build
FROM golang:1.25-alpine AS server-build
WORKDIR /src/server
COPY server/go.mod server/go.sum ./
RUN go mod download
COPY server/ ./
RUN go test ./...
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/box-manifest-server ./cmd/box-manifest-server
FROM alpine:3.22
RUN addgroup -g 10001 box-manifest \
&& adduser -D -H -u 10001 -G box-manifest box-manifest \
&& apk add --no-cache ca-certificates
WORKDIR /app
COPY --from=server-build /out/box-manifest-server ./box-manifest-server
COPY --from=web-build /src/web/dist ./web
RUN mkdir /data && chown box-manifest:box-manifest /data
USER 10001:10001
EXPOSE 8080
VOLUME ["/data"]
ENTRYPOINT ["/app/box-manifest-server"]
CMD ["-address", ":8080", "-database", "/data/box-manifest.db", "-web", "/app/web"]