|
| 1 | +FROM golang:1.19-alpine AS builder |
| 2 | +ENV CGO_ENABLED=0 |
| 3 | +WORKDIR /backend |
| 4 | +COPY vm/go.* ./ |
| 5 | +RUN --mount=type=cache,target=/go/pkg/mod \ |
| 6 | + --mount=type=cache,target=/root/.cache/go-build \ |
| 7 | + go mod download |
| 8 | +COPY vm/. . |
| 9 | +RUN --mount=type=cache,target=/go/pkg/mod \ |
| 10 | + --mount=type=cache,target=/root/.cache/go-build \ |
| 11 | + go build -trimpath -ldflags="-s -w" -o bin/service |
| 12 | + |
| 13 | +FROM --platform=$BUILDPLATFORM node:18.9-alpine3.15 AS client-builder |
| 14 | +WORKDIR /ui |
| 15 | +# cache packages in layer |
| 16 | +COPY ui/package.json /ui/package.json |
| 17 | +COPY ui/package-lock.json /ui/package-lock.json |
| 18 | +RUN --mount=type=cache,target=/usr/src/app/.npm \ |
| 19 | + npm set cache /usr/src/app/.npm && \ |
| 20 | + npm ci |
| 21 | +# install |
| 22 | +COPY ui /ui |
| 23 | +RUN npm run build |
| 24 | + |
| 25 | +FROM alpine |
| 26 | +LABEL org.opencontainers.image.title="Fetchit" \ |
| 27 | + org.opencontainers.image.description=" FetchIt is used to manage the life cycle and configuration of Podman containers" \ |
| 28 | + org.opencontainers.image.vendor="Red Hat Inc." \ |
| 29 | + com.docker.desktop.extension.api.version="0.3.0" \ |
| 30 | + com.docker.extension.screenshots="" \ |
| 31 | + com.docker.extension.detailed-description="" \ |
| 32 | + com.docker.extension.publisher-url="" \ |
| 33 | + com.docker.extension.additional-urls="" \ |
| 34 | + com.docker.extension.changelog="" |
| 35 | + |
| 36 | +COPY --from=builder /backend/bin/service / |
| 37 | +COPY docker-compose.yaml . |
| 38 | +COPY metadata.json . |
| 39 | +COPY docker.svg . |
| 40 | +COPY --from=client-builder /ui/build ui |
| 41 | +CMD /service -socket /run/guest-services/extension-fetchit.sock |
0 commit comments