61 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
FROM golang as builder
 | 
						|
 | 
						|
LABEL maintainer="Valentin KIVACHUK BURDA"
 | 
						|
 | 
						|
ENV DOCKER_ENVIRONMENT=true
 | 
						|
ENV CGO_ENABLED=0
 | 
						|
ENV GOOS=linux
 | 
						|
ENV GO111MODULE=on
 | 
						|
 | 
						|
EXPOSE 49618
 | 
						|
 | 
						|
WORKDIR /go/src/oc-catalog
 | 
						|
 | 
						|
#######################################################
 | 
						|
 | 
						|
COPY go.mod .
 | 
						|
COPY go.sum .
 | 
						|
 | 
						|
RUN go get github.com/beego/bee/v2 && go install github.com/beego/bee/v2@master
 | 
						|
 | 
						|
# Manually download swagger during build
 | 
						|
RUN ["/bin/bash", "-c", \
 | 
						|
    "set -eo pipefail; \
 | 
						|
    mkdir -p swagger; \
 | 
						|
    curl -sL https://github.com/beego/swagger/archive/v3.tar.gz | tar xvvvz --overwrite -C swagger --strip-components=1"]
 | 
						|
 | 
						|
 | 
						|
RUN go mod download -x
 | 
						|
 | 
						|
# COPY . .
 | 
						|
COPY main.go go.mod go.sum ./
 | 
						|
 | 
						|
COPY controllers controllers
 | 
						|
COPY models models
 | 
						|
COPY routers routers
 | 
						|
COPY selfapi selfapi
 | 
						|
COPY services services
 | 
						|
COPY conf conf
 | 
						|
COPY scripts scripts
 | 
						|
 | 
						|
# RUN go build -a -tags netgo -ldflags '-w -extldflags "-static"' -installsuffix cgo .
 | 
						|
 | 
						|
RUN bee generate docs
 | 
						|
 | 
						|
# COPY . .
 | 
						|
 | 
						|
 | 
						|
# FROM golang
 | 
						|
 | 
						|
# WORKDIR /go/src/oc-catalog
 | 
						|
 | 
						|
# COPY --from=builder /go/src/oc-catalog .
 | 
						|
 | 
						|
ENV DOCKER_ENVIRONMENT=true
 | 
						|
 | 
						|
RUN go build .
 | 
						|
 | 
						|
# UglyFix: Generate comments from swagger
 | 
						|
RUN timeout 10 bee run -runargs test || exit 0
 | 
						|
 | 
						|
CMD [ "bee", "run", "-gendoc=true" ] |