Files
open-im-server/Dockerfile
T

37 lines
1.1 KiB
Docker
Raw Normal View History

2023-07-13 15:45:03 +08:00
# Build Stage
FROM golang:1.20 AS builder
LABEL org.opencontainers.image.source=https://github.com/OpenIMSDK/Open-IM-Server
LABEL org.opencontainers.image.description="OpenIM Server image"
LABEL org.opencontainers.image.licenses="Apache 2.0"
2023-06-30 18:59:56 +08:00
2023-07-13 15:45:03 +08:00
# Set go mod installation source and proxy
ARG GO111MODULE=on
ARG GOPROXY=https://goproxy.cn,direct
ENV GO111MODULE=$GO111MODULE
ENV GOPROXY=$GOPROXY
2023-06-30 18:59:56 +08:00
# Set up the working directory
WORKDIR /Open-IM-Server
2023-07-13 15:45:03 +08:00
# Copy all files to the container
ADD . .
2023-06-30 18:59:56 +08:00
2023-07-13 15:45:03 +08:00
RUN /bin/sh -c "make build"
2023-06-30 18:59:56 +08:00
2023-07-13 15:45:03 +08:00
# Production Stage
FROM alpine
2023-06-30 18:59:56 +08:00
2023-07-28 15:09:04 +08:00
RUN echo "https://mirrors.aliyun.com/alpine/v3.4/main" > /etc/apk/repositories && \
2023-07-28 22:49:55 +08:00
apk --no-cache add tzdata ca-certificates bash
2023-06-30 18:59:56 +08:00
2023-07-13 15:45:03 +08:00
# Set directory to map logs, config files, scripts, and SDK
VOLUME ["/Open-IM-Server/logs", "/Open-IM-Server/config", "/Open-IM-Server/scripts", "/Open-IM-Server/db/sdk"]
2023-06-30 18:59:56 +08:00
2023-07-13 15:45:03 +08:00
# Copy scripts and binary files to the production image
COPY --from=builder /Open-IM-Server/scripts /Open-IM-Server/scripts
COPY --from=builder /Open-IM-Server/_output/bin/platforms/linux/amd64 /Open-IM-Server/_output/bin/platforms/linux/amd64
2023-06-30 18:59:56 +08:00
2023-06-30 23:16:33 +08:00
WORKDIR /Open-IM-Server/scripts
2023-06-30 18:59:56 +08:00
2023-07-28 22:49:55 +08:00
CMD ["./docker_start_all.sh"]