-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge main into sweep/add-sweep-config
- Loading branch information
Showing
6 changed files
with
54 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -374,4 +374,3 @@ dist | |
# config files, may contain sensitive informatio | ||
config/config.yaml | ||
|
||
start-config.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,49 @@ | ||
# Copyright © 2023 OpenIM open source community. All rights reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
ARG GOARCH | ||
ARG GOOS | ||
|
||
# Use golang as the builder stage | ||
FROM golang:1.21 AS builder | ||
|
||
ARG GO111MODULE=on | ||
ARG GOPROXY=https://goproxy.io,direct | ||
|
||
WORKDIR /openim/openim-chat | ||
|
||
ENV GO111MODULE=$GO111MODULE | ||
ENV GOPROXY=$GOPROXY | ||
|
||
COPY go.mod go.sum ./ | ||
# Use Go 1.21 Alpine as the base image for building the application | ||
FROM golang:1.21-alpine as builder | ||
|
||
# Define the base directory for the application as an environment variable | ||
ENV SERVER_DIR=/openim-chat | ||
|
||
# Set the working directory inside the container based on the environment variable | ||
WORKDIR $SERVER_DIR | ||
|
||
# Set the Go proxy to improve dependency resolution speed | ||
ENV GOPROXY=https://goproxy.io,direct | ||
|
||
# Copy all files from the current directory into the container | ||
COPY . . | ||
|
||
RUN go mod download | ||
|
||
# Copy all files to the container | ||
ADD . . | ||
# Install Mage to use for building the application | ||
RUN go install github.com/magefile/[email protected] | ||
|
||
# Optionally build your application if needed | ||
RUN mage build | ||
|
||
# Using Alpine Linux with Go environment for the final image | ||
FROM golang:1.21-alpine | ||
|
||
# Install necessary packages, such as bash | ||
RUN apk add --no-cache bash | ||
|
||
RUN make clean | ||
RUN make build | ||
# Set the environment and work directory | ||
ENV SERVER_DIR=/openim-chat | ||
WORKDIR $SERVER_DIR | ||
|
||
# Build the runtime stage | ||
FROM ghcr.io/openim-sigs/openim-ubuntu-image:latest | ||
|
||
WORKDIR ${CHAT_WORKDIR} | ||
# Copy the compiled binaries and mage from the builder image to the final image | ||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output | ||
COPY --from=builder $SERVER_DIR/config $SERVER_DIR/config | ||
COPY --from=builder /go/bin/mage /usr/local/bin/mage | ||
COPY --from=builder $SERVER_DIR/magefile_windows.go $SERVER_DIR/ | ||
COPY --from=builder $SERVER_DIR/magefile_unix.go $SERVER_DIR/ | ||
COPY --from=builder $SERVER_DIR/magefile.go $SERVER_DIR/ | ||
COPY --from=builder $SERVER_DIR/start-config.yml $SERVER_DIR/ | ||
COPY --from=builder $SERVER_DIR/go.mod $SERVER_DIR/ | ||
COPY --from=builder $SERVER_DIR/go.sum $SERVER_DIR/ | ||
|
||
COPY --from=builder ${OPENIM_CHAT_BINDIR} /openim/openim-chat/_output/bin | ||
COPY --from=builder ${CHAT_WORKDIR}/config /openim/openim-chat/config | ||
COPY --from=builder ${CHAT_WORKDIR}/scripts /openim/openim-chat/scripts | ||
COPY --from=builder ${CHAT_WORKDIR}/deployments /openim/openim-chat/deployments | ||
RUN go get github.com/openimsdk/[email protected] | ||
|
||
CMD ["/openim/openim-chat/scripts/docker-start-all.sh"] | ||
# Set the command to run when the container starts | ||
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
serviceBinaries: | ||
chat-api: 1 | ||
chat-rpc: 1 | ||
admin-api: 1 | ||
admin-rpc: 1 | ||
toolBinaries: | ||
- check-component | ||
maxFileDescriptors: 10000 |