deploy.Dockerfile 1.2 KB
Newer Older
落凡尘.'s avatar
落凡尘. 已提交
1 2 3 4 5 6 7
FROM golang:1.15 as build

# go mod Installation source, container environment variable addition will override the default variable value
ENV GO111MODULE=on
ENV GOPROXY=https://goproxy.cn,direct

# Set up the working directory
落凡尘.'s avatar
落凡尘. 已提交
8
WORKDIR /home/Open-IM-Server
落凡尘.'s avatar
落凡尘. 已提交
9 10 11
# add all files to the container
COPY . .

落凡尘.'s avatar
落凡尘. 已提交
12
WORKDIR /home/Open-IM-Server/script
落凡尘.'s avatar
落凡尘. 已提交
13 14
RUN chmod +x *.sh

落凡尘.'s avatar
落凡尘. 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
RUN /bin/sh -c ./build_all_service.sh

#Blank image Multi-Stage Build
FROM ubuntu

RUN rm -rf /var/lib/apt/lists/*
RUN apt-get install apt-transport-https && apt-get update && apt-get install procps\
&&apt-get install net-tools
#Non-interactive operation
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get install -y vim curl tzdata gawk
#Time zone adjusted to East eighth District
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && dpkg-reconfigure -f noninteractive tzdata


#set directory to map logs,config file,script file.
VOLUME ["/home/Open-IM-Server/logs","/home/Open-IM-Server/config","/home/Open-IM-Server/script"]
落凡尘.'s avatar
落凡尘. 已提交
32

落凡尘.'s avatar
落凡尘. 已提交
33 34 35
#Copy scripts files and binary files to the blank image
COPY --from=build /home/Open-IM-Server/script /home/Open-IM-Server/script
COPY --from=build /home/Open-IM-Server/bin /home/Open-IM-Server/bin
落凡尘.'s avatar
落凡尘. 已提交
36

落凡尘.'s avatar
落凡尘. 已提交
37
WORKDIR /home/Open-IM-Server/script
落凡尘.'s avatar
落凡尘. 已提交
38

落凡尘.'s avatar
落凡尘. 已提交
39
CMD ["./start_all.sh"]