forked from openshift/assisted-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.assisted-service
33 lines (29 loc) · 1.32 KB
/
Dockerfile.assisted-service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Generate python client
FROM swaggerapi/swagger-codegen-cli:2.4.15 as swagger_py
COPY swagger.yaml .
COPY tools/generate_python_client.sh .
RUN chmod +x ./generate_python_client.sh && SWAGGER_FILE=swagger.yaml OUTPUT=/build ./generate_python_client.sh
# Generate go client
FROM quay.io/goswagger/swagger:v0.25.0 as swagger_go
COPY . .
RUN mkdir /build
RUN swagger generate server --template=stratoscale -f swagger.yaml --template-dir=/templates/contrib \
&& mv restapi models /build
RUN swagger generate client --template=stratoscale -f swagger.yaml --template-dir=/templates/contrib \
&& mv client /build
# Build binaries
FROM registry.svc.ci.openshift.org/openshift/release:golang-1.14 as builder
COPY . .
COPY --from=swagger_py /build build
COPY --from=swagger_go /build/client client
COPY --from=swagger_go /build/models models
COPY --from=swagger_go /build/restapi restapi
RUN CGO_ENABLED=0 GOFLAGS="" GO111MODULE=on go build -o /build/assisted-service cmd/main.go
RUN cd build && python3 setup.py sdist --dist-dir /assisted-service-client
# Create final image
FROM registry.access.redhat.com/ubi8/ubi:latest
ARG GIT_REVISION
LABEL "git_revision"=${GIT_REVISION}
COPY --from=builder /build/assisted-service /assisted-service
COPY --from=builder /assisted-service-client/assisted-service-client-*.tar.gz /clients/
CMD ["/assisted-service"]