ARG VERSION FROM golang:latest AS builder MAINTAINER sk WORKDIR /projects/go COPY framework/ framework/ COPY ecs/ ecs/ WORKDIR /projects/go/ecs ENV CGO_ENABLED=0 ENV GOOS=linux ENV GOARCH=amd64 ENV GO111MODULE=on RUN go env -w GOPROXY=https://goproxy.cn,direct RUN go mod tidy RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ezs_center ./servers/user RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ezs_event ./servers/event RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ezs_game ./servers/game RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ezs_gate ./servers/gate # Target user FROM alpine:latest AS ezs_user WORKDIR /app/ecs/user COPY --from=builder /projects/go/ecs/build/bin/ezs_user ./bin/ezs_user CMD ./bin/ezs_user -help # Target event FROM alpine:latest AS ezs_event WORKDIR /app/ecs/event COPY --from=builder /projects/go/ecs/build/bin/ezs_event ./bin/ezs_event CMD ./bin/ezs_event -help # Target game FROM alpine:latest AS ezs_game WORKDIR /app/ecs/game COPY --from=builder /projects/go/ecs/build/bin/ezs_game ./bin/ezs_game CMD ./bin/ezs_game -help # Target gate FROM alpine:latest AS ezs_gate WORKDIR /app/ecs/gate COPY --from=builder /projects/go/ecs/build/bin/ezs_gate ./bin/ezs_gate CMD ./bin/ezs_gate -help