Skip to content

Commit

Permalink
Merge main into sweep/add-sweep-config
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Apr 23, 2024
2 parents 4c28064 + 74f8d1a commit fd28cff
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 48 deletions.
4 changes: 1 addition & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
.dockerignore

# Ignore build artifacts
_output/
logs/
_output/

# Ignore non-essential documentation
README.md
Expand All @@ -17,8 +17,6 @@ CHANGELOG/
# Ignore testing and linting configuration
.golangci.yml

# Ignore deployment-related files
docker-compose.yaml

# Ignore assets
assets/
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -374,4 +374,3 @@ dist
# config files, may contain sensitive informatio
config/config.yaml

start-config.yml
83 changes: 42 additions & 41 deletions Dockerfile
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"]
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ require (
require (
github.com/livekit/protocol v1.10.1
github.com/mitchellh/mapstructure v1.5.0
github.com/openimsdk/gomake v0.0.6
github.com/openimsdk/gomake v0.0.9-alpha.3
github.com/openimsdk/protocol v0.0.63
github.com/openimsdk/tools v0.0.49-alpha.1
github.com/redis/go-redis/v9 v9.5.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ github.com/nats-io/nkeys v0.4.6/go.mod h1:4DxZNzenSVd1cYQoAa8948QY3QDjrHfcfVADym
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/openimsdk/gomake v0.0.6 h1:bJmQWDHBj8PQ7oGJ2SL3Gsx0k5CdI/BPfGzlGcV105s=
github.com/openimsdk/gomake v0.0.6/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
github.com/openimsdk/gomake v0.0.9-alpha.3 h1:KO3stbmiTksnnx2o2Lh8/FkKXc7qiF4rwPnr01WO7aM=
github.com/openimsdk/gomake v0.0.9-alpha.3/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
github.com/openimsdk/protocol v0.0.63 h1:9DnweZe9nEYDFa4fGTbC9Cqi0gLUdtBhRo1NRP2X3WQ=
github.com/openimsdk/protocol v0.0.63/go.mod h1:OZQA9FR55lseYoN2Ql1XAHYKHJGu7OMNkUbuekrKCM8=
github.com/openimsdk/tools v0.0.49-alpha.1 h1:LtlKh5t/1b1tNikR9LWwV9PIJclUNsVqpEzEke4CMtk=
Expand Down
8 changes: 8 additions & 0 deletions start-config.yml
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

0 comments on commit fd28cff

Please sign in to comment.