ci: making orborus build faster
This commit is contained in:
Executable → Regular
+24
-27
@@ -1,36 +1,33 @@
|
|||||||
FROM golang:1.22 as builder
|
FROM golang:1.22 as builder
|
||||||
|
|
||||||
RUN mkdir /app
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY orborus.go /app/orborus.go
|
# Copy go.mod and go.sum first (if you have them)
|
||||||
#COPY go.mod /app/go.mod
|
# This allows better caching of dependencies
|
||||||
#COPY go.sum /app/go.sum
|
# COPY go.* ./
|
||||||
RUN go mod init orborus
|
RUN go mod init orborus
|
||||||
|
|
||||||
RUN go get github.com/docker/docker/api/types
|
# Combine all go get commands into a single layer
|
||||||
RUN go get github.com/docker/docker/api/types/container
|
RUN go get \
|
||||||
#RUN go get github.com/docker/docker/client
|
github.com/docker/docker/api/types \
|
||||||
RUN go get github.com/mackerelio/go-osstat/cpu
|
github.com/docker/docker/api/types/container \
|
||||||
RUN go get github.com/mackerelio/go-osstat/memory
|
github.com/mackerelio/go-osstat/cpu \
|
||||||
RUN go get github.com/satori/go.uuid
|
github.com/mackerelio/go-osstat/memory \
|
||||||
RUN go get github.com/shuffle/shuffle-shared
|
github.com/satori/go.uuid \
|
||||||
RUN go get github.com/shirou/gopsutil
|
github.com/shuffle/shuffle-shared \
|
||||||
# RUN go get k8s.io/client-go
|
github.com/shirou/gopsutil
|
||||||
# RUN go get k8s.io/apimachinery
|
|
||||||
|
|
||||||
RUN go get
|
# Copy the rest of the code
|
||||||
RUN go mod tidy
|
COPY orborus.go .
|
||||||
RUN go build
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o orborus .
|
RUN go mod tidy && \
|
||||||
|
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o orborus .
|
||||||
|
|
||||||
FROM alpine:3.15.0
|
FROM alpine:3.15.0
|
||||||
RUN apk add --no-cache bash tzdata
|
RUN apk add --no-cache bash tzdata
|
||||||
COPY --from=builder /app/ /
|
COPY --from=builder /app/orborus /
|
||||||
|
ENV ENVIRONMENT_NAME=Shuffle \
|
||||||
ENV ENVIRONMENT_NAME=Shuffle
|
BASE_URL=http://shuffle-backend:5001 \
|
||||||
ENV BASE_URL=http://shuffle-backend:5001
|
DOCKER_API_VERSION=1.40 \
|
||||||
ENV DOCKER_API_VERSION=1.40
|
SHUFFLE_OPENSEARCH_URL=https://opensearch:9200
|
||||||
ENV SHUFFLE_OPENSEARCH_URL=https://opensearch:9200
|
CMD ["./orborus"]
|
||||||
|
|
||||||
CMD ["./orborus"]
|
|
||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
FROM golang:1.22 as builder
|
||||||
|
|
||||||
|
RUN mkdir /app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY orborus.go /app/orborus.go
|
||||||
|
#COPY go.mod /app/go.mod
|
||||||
|
#COPY go.sum /app/go.sum
|
||||||
|
RUN go mod init orborus
|
||||||
|
|
||||||
|
RUN go get github.com/docker/docker/api/types
|
||||||
|
RUN go get github.com/docker/docker/api/types/container
|
||||||
|
#RUN go get github.com/docker/docker/client
|
||||||
|
RUN go get github.com/mackerelio/go-osstat/cpu
|
||||||
|
RUN go get github.com/mackerelio/go-osstat/memory
|
||||||
|
RUN go get github.com/satori/go.uuid
|
||||||
|
RUN go get github.com/shuffle/shuffle-shared
|
||||||
|
RUN go get github.com/shirou/gopsutil
|
||||||
|
# RUN go get k8s.io/client-go
|
||||||
|
# RUN go get k8s.io/apimachinery
|
||||||
|
|
||||||
|
RUN go get
|
||||||
|
RUN go mod tidy
|
||||||
|
RUN go build
|
||||||
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o orborus .
|
||||||
|
|
||||||
|
FROM alpine:3.15.0
|
||||||
|
RUN apk add --no-cache bash tzdata
|
||||||
|
COPY --from=builder /app/ /
|
||||||
|
|
||||||
|
ENV ENVIRONMENT_NAME=Shuffle
|
||||||
|
ENV BASE_URL=http://shuffle-backend:5001
|
||||||
|
ENV DOCKER_API_VERSION=1.40
|
||||||
|
ENV SHUFFLE_OPENSEARCH_URL=https://opensearch:9200
|
||||||
|
|
||||||
|
CMD ["./orborus"]
|
||||||
Reference in New Issue
Block a user