mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-07-07 04:11:08 +08:00
* refactor(changelog): modernize generator and workflows * test(core): use stable Go in build test workflow * refactor(core): use golang alpine base image * fix(build): limit docker compose parallelism * refactor(build): inline compose build logic * fix(core): reorder Dockerfile ARG declarations
30 lines
610 B
Docker
30 lines
610 B
Docker
FROM golang:alpine AS builder
|
|
|
|
ENV SERVER_DIR=/openim-server
|
|
WORKDIR $SERVER_DIR
|
|
|
|
COPY . .
|
|
RUN go mod tidy
|
|
|
|
ARG CMD_PATH
|
|
ARG BINARY_NAME
|
|
ARG RELEASE=false
|
|
|
|
RUN if [ "$RELEASE" = "true" ]; then \
|
|
go build -trimpath -ldflags "-s -w" -o _output/${BINARY_NAME} ./${CMD_PATH}; \
|
|
else \
|
|
go build -o _output/${BINARY_NAME} ./${CMD_PATH}; \
|
|
fi
|
|
|
|
FROM alpine:latest
|
|
|
|
RUN apk add --no-cache bash
|
|
|
|
ARG BINARY_NAME
|
|
ENV BINARY_NAME=${BINARY_NAME}
|
|
ENV SERVER_DIR=/openim-server
|
|
WORKDIR $SERVER_DIR
|
|
|
|
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
|
|
|
ENTRYPOINT ["sh", "-c", "_output/${BINARY_NAME}"] |