2023-11-02 15:49:33 +01:00
|
|
|
|
FROM golang:alpine as builder
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2023-11-02 15:49:33 +01:00
|
|
|
|
WORKDIR /app
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2023-11-02 15:49:33 +01:00
|
|
|
|
COPY . .
|
2023-10-18 11:01:41 +02:00
|
|
|
|
|
2024-02-19 17:56:33 +01:00
|
|
|
|
RUN go get github.com/beego/bee/v2 && \
|
|
|
|
|
go install github.com/beego/bee/v2@master
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2024-02-19 17:24:14 +01:00
|
|
|
|
# Generating routers/commentsRouter.go
|
|
|
|
|
RUN bee generate routers
|
|
|
|
|
|
2023-11-02 15:49:33 +01:00
|
|
|
|
# Generating the swagger
|
|
|
|
|
RUN timeout 20 bee run -gendoc=true -downdoc=true -runmode=dev || :
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2024-02-19 17:56:33 +01:00
|
|
|
|
RUN sed -i 's/http:\/\/127.0.0.1:8080\/swagger\/swagger.json/swagger.json/g' swagger/index.html && \
|
|
|
|
|
sed -i 's/https:\/\/petstore.swagger.io\/v2\/swagger.json/swagger.json/g' swagger/index.html
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2024-02-19 17:24:14 +01:00
|
|
|
|
RUN ls -l routers
|
2024-02-15 10:52:29 +01:00
|
|
|
|
|
2023-11-02 15:49:33 +01:00
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" .
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2023-11-02 15:49:33 +01:00
|
|
|
|
FROM scratch
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2023-11-02 15:49:33 +01:00
|
|
|
|
WORKDIR /app
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2023-11-02 15:49:33 +01:00
|
|
|
|
COPY ./docker_catalog.json /etc/oc/catalog.json
|
2024-02-16 17:30:09 +01:00
|
|
|
|
COPY conf/app.conf /app/conf/
|
2023-11-02 15:49:33 +01:00
|
|
|
|
COPY --from=builder /app/oc-catalog /usr/bin/
|
|
|
|
|
COPY --from=builder /app/swagger /app/swagger
|
2023-03-03 14:43:11 +01:00
|
|
|
|
|
2023-11-02 15:49:33 +01:00
|
|
|
|
ENTRYPOINT ["oc-catalog"]
|