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/ecs_center ./servers/user RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ecs_event ./servers/event RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ecs_game ./servers/game RUN go build -mod readonly -ldflags "-X 'framework/server.buildVersion=${VERSION}' -X 'framework/profile.Active=prod'" -o ./build/bin/ecs_gate ./servers/gate # Target ecs FROM alpine:latest AS ecs WORKDIR /app/ecs COPY --from=builder /projects/go/ecs/app.sh app.sh RUN chmod +x ./app.sh COPY --from=builder /projects/go/ecs/build/bin/ecs_user user/bin/ecs_user COPY --from=builder /projects/go/ecs/build/bin/ecs_event event/bin/ecs_event COPY --from=builder /projects/go/ecs/build/bin/ecs_game game/bin/ecs_game COPY --from=builder /projects/go/ecs/build/bin/ecs_gate gate/bin/ecs_gate CMD ./app.sh help ## Target user #FROM alpine:latest AS ecs_user # #WORKDIR /app/ecs/user # #COPY --from=builder /projects/go/ecs/build/bin/ecs_user ./bin/ecs_user # #CMD ./bin/ecs_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