mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 21:22:16 +08:00
style: Migrate directory to remove docker to images
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
parent
7327f11794
commit
3640499340
26
.github/workflows/docker-buildx.yml
vendored
26
.github/workflows/docker-buildx.yml
vendored
@ -95,7 +95,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-api/Dockerfile
|
||||
file: ./build/images/openim-api/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta1.outputs.tags }}
|
||||
@ -113,7 +113,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-cmdutils/Dockerfile
|
||||
file: ./build/images/openim-cmdutils/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta2.outputs.tags }}
|
||||
@ -131,7 +131,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-crontask/Dockerfile
|
||||
file: ./build/images/openim-crontask/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta3.outputs.tags }}
|
||||
@ -149,7 +149,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-msggateway/Dockerfile
|
||||
file: ./build/images/openim-msggateway/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta4.outputs.tags }}
|
||||
@ -167,7 +167,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-msgtransfer/Dockerfile
|
||||
file: ./build/images/openim-msgtransfer/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta5.outputs.tags }}
|
||||
@ -185,7 +185,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-push/Dockerfile
|
||||
file: ./build/images/openim-push/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta6.outputs.tags }}
|
||||
@ -203,7 +203,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-rpc-auth/Dockerfile
|
||||
file: ./build/images/openim-rpc-auth/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta7.outputs.tags }}
|
||||
@ -221,7 +221,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-rpc-conversation/Dockerfile
|
||||
file: ./build/images/openim-rpc-conversation/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta8.outputs.tags }}
|
||||
@ -239,7 +239,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-rpc-friend/Dockerfile
|
||||
file: ./build/images/openim-rpc-friend/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta9.outputs.tags }}
|
||||
@ -257,7 +257,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-rpc-group/Dockerfile
|
||||
file: ./build/images/openim-rpc-group/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta10.outputs.tags }}
|
||||
@ -275,7 +275,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-rpc-msg/Dockerfile
|
||||
file: ./build/images/openim-rpc-msg/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta11.outputs.tags }}
|
||||
@ -293,7 +293,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-rpc-third/Dockerfile
|
||||
file: ./build/images/openim-rpc-third/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta12.outputs.tags }}
|
||||
@ -311,7 +311,7 @@ jobs:
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: ./build/docker/openim-rpc-user/Dockerfile
|
||||
file: ./build/images/openim-rpc-user/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta13.outputs.tags }}
|
||||
|
||||
45
docs/contrib/install_docker.md
Normal file
45
docs/contrib/install_docker.md
Normal file
@ -0,0 +1,45 @@
|
||||
# Install Docker
|
||||
|
||||
The installation command is as follows:
|
||||
|
||||
```bash
|
||||
$ curl -fsSL https://get.docker.com | bash -s docker --mirror aliyun
|
||||
``
|
||||
|
||||
## 2.2 Start Docker
|
||||
|
||||
```bash
|
||||
$ systemctl start docker
|
||||
```
|
||||
|
||||
## 2.3 Test Docker
|
||||
|
||||
```bash
|
||||
$ docker run hello-world
|
||||
```
|
||||
|
||||
## 2.4 Configure Docker Acceleration
|
||||
|
||||
```bash
|
||||
$ mkdir -p /etc/docker
|
||||
$ tee /etc/docker/daemon.json <<-'EOF'
|
||||
{
|
||||
"registry-mirrors": ["https://registry.docker-cn.com"]
|
||||
}
|
||||
EOF
|
||||
$ systemctl daemon-reload
|
||||
$ systemctl restart docker
|
||||
```
|
||||
|
||||
## 2.5 Install Docker Compose
|
||||
|
||||
```bash
|
||||
$ sudo curl -L "https://github.com/docker/compose/releases/download/latest/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
$ sudo chmod +x /usr/local/bin/docker-compose
|
||||
```
|
||||
|
||||
## 2.6 Test Docker Compose
|
||||
|
||||
```bash
|
||||
$ docker-compose --version
|
||||
```
|
||||
137
docs/contrib/linux_development.md
Normal file
137
docs/contrib/linux_development.md
Normal file
@ -0,0 +1,137 @@
|
||||
# Ubuntu 22.04 OpenIM Project Development Guide
|
||||
|
||||
## TOC
|
||||
- [Ubuntu 22.04 OpenIM Project Development Guide](#ubuntu-2204-openim-project-development-guide)
|
||||
- [TOC](#toc)
|
||||
- [1. Setting Up Ubuntu Server](#1-setting-up-ubuntu-server)
|
||||
- [1.1 Create `openim` Standard User](#11-create-openim-standard-user)
|
||||
- [1.2 Setting up the `openim` User's Shell Environment](#12-setting-up-the-openim-users-shell-environment)
|
||||
- [1.3 Installing Dependencies](#13-installing-dependencies)
|
||||
|
||||
## 1. Setting Up Ubuntu Server
|
||||
|
||||
You can use tools like PuTTY or other SSH clients to log in to your Ubuntu server. Once logged in, a few fundamental configurations are required, such as creating a standard user, adding to sudoers, and setting up the `$HOME/.bashrc` file. The steps are as follows:
|
||||
|
||||
## 1.1 Create `openim` Standard User
|
||||
|
||||
1. Log in to the Ubuntu system as the `root` user and create a standard user.
|
||||
|
||||
Generally, a project will involve multiple developers. Instead of provisioning a server for every developer, many organizations share a single development machine among developers. To simulate this real-world scenario, we'll use a standard user for development. To create the `openim` user:
|
||||
|
||||
```
|
||||
bashCopy code# adduser openim # Create the openim user, which developers will use for login and development.
|
||||
# passwd openim # Set the login password for openim.
|
||||
```
|
||||
|
||||
Working with a non-root user ensures the system's safety and is a good practice. It's recommended to avoid using the root user as much as possible during everyday development.
|
||||
|
||||
1. Add to sudoers.
|
||||
|
||||
Often, even standard users need root privileges. Instead of frequently asking the system administrator for the root password, you can add the standard user to the sudoers. This allows them to temporarily gain root access using the sudo command. To add the `openim` user to sudoers:
|
||||
|
||||
```
|
||||
bashCopy code
|
||||
# sed -i '/^root.*ALL=(ALL:ALL).*ALL/a\openim\tALL=(ALL) \tALL' /etc/sudoers
|
||||
```
|
||||
|
||||
## 1.2 Setting up the `openim` User's Shell Environment
|
||||
|
||||
1. Log into the Ubuntu system.
|
||||
|
||||
Assuming we're using the **openim** user, log in using PuTTY or other SSH clients.
|
||||
|
||||
1. Configure the `$HOME/.bashrc` file.
|
||||
|
||||
The first step after logging into a new server is to configure the `$HOME/.bashrc` file. It makes the Linux shell more user-friendly by setting environment variables like `LANG` and `PS1`. Here's how the configuration would look:
|
||||
|
||||
```
|
||||
bashCopy code# .bashrc
|
||||
|
||||
# User specific aliases and functions
|
||||
|
||||
alias rm='rm -i'
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
if [ ! -d $HOME/workspace ]; then
|
||||
mkdir -p $HOME/workspace
|
||||
fi
|
||||
|
||||
# User specific environment
|
||||
export LANG="en_US.UTF-8"
|
||||
export PS1='[\u@dev \W]\$ '
|
||||
export WORKSPACE="$HOME/workspace"
|
||||
export PATH=$HOME/bin:$PATH
|
||||
|
||||
cd $WORKSPACE
|
||||
```
|
||||
|
||||
After updating `$HOME/.bashrc`, run the `bash` command to reload the configurations into the current shell.
|
||||
|
||||
## 1.3 Installing Dependencies
|
||||
|
||||
The OpenIM project on Ubuntu may have various dependencies. Some are direct, and others are indirect. Installing these in advance prevents issues like missing packages or compile-time errors later on.
|
||||
|
||||
1. Install dependencies.
|
||||
|
||||
You can use the `apt` command to install the required tools on Ubuntu:
|
||||
|
||||
```
|
||||
bashCopy code$ sudo apt-get update
|
||||
$ sudo apt-get install build-essential autoconf automake cmake perl libcurl4-gnutls-dev libtool gcc g++ glibc-doc-reference zlib1g-dev git-lfs telnet lrzsz jq libexpat1-dev libssl-dev
|
||||
$ sudo apt install libcurl4-openssl-dev
|
||||
```
|
||||
|
||||
1. Install Git.
|
||||
|
||||
A higher version of Git ensures compatibility with certain commands like `git fetch --unshallow`. To install a recent version:
|
||||
|
||||
```
|
||||
bashCopy code$ cd /tmp
|
||||
$ wget --no-check-certificate https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.36.1.tar.gz
|
||||
$ tar -xvzf git-2.36.1.tar.gz
|
||||
$ cd git-2.36.1/
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
$ git --version
|
||||
```
|
||||
|
||||
Then, add Git's binary directory to the `PATH`:
|
||||
|
||||
```
|
||||
bashCopy code
|
||||
$ echo 'export PATH=/usr/local/libexec/git-core:$PATH' >> $HOME/.bashrc
|
||||
```
|
||||
|
||||
1. Configure Git.
|
||||
|
||||
To set up Git:
|
||||
|
||||
```
|
||||
bashCopy code$ git config --global user.name "Your Name"
|
||||
$ git config --global user.email "your_email@example.com"
|
||||
$ git config --global credential.helper store
|
||||
$ git config --global core.longpaths true
|
||||
```
|
||||
|
||||
Other Git configurations include:
|
||||
|
||||
```
|
||||
bashCopy code
|
||||
$ git config --global core.quotepath off
|
||||
```
|
||||
|
||||
And for handling larger files:
|
||||
|
||||
```
|
||||
bashCopy code
|
||||
$ git lfs install --skip-repo
|
||||
```
|
||||
|
||||
By following the steps in this guide, your Ubuntu 22.04 server should now be set up and ready for OpenIM project development.
|
||||
@ -23,7 +23,7 @@ readonly OPENIM_SUPPORTED_SERVER_PLATFORMS=(
|
||||
)
|
||||
|
||||
# If we update this we should also update the set of platforms whose standard
|
||||
# library is precompiled for in build/build-image/cross/Dockerfile
|
||||
# library is precompiled for in build/image/cross/Dockerfile
|
||||
readonly OPENIM_SUPPORTED_CLIENT_PLATFORMS=(
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
|
||||
@ -60,7 +60,6 @@ openim::util::ensure-bash-version
|
||||
|
||||
. $(dirname ${BASH_SOURCE})/version.sh
|
||||
. $(dirname ${BASH_SOURCE})/golang.sh
|
||||
. $(dirname ${BASH_SOURCE})/test.sh
|
||||
. $(dirname ${BASH_SOURCE})/release.sh
|
||||
. $(dirname ${BASH_SOURCE})/chat.sh
|
||||
|
||||
|
||||
@ -39,8 +39,8 @@ ifneq ($(EXTRA_ARGS), )
|
||||
_DOCKER_BUILD_EXTRA_ARGS += $(EXTRA_ARGS)
|
||||
endif
|
||||
|
||||
# Determine image files by looking into build/docker/*/Dockerfile
|
||||
IMAGES_DIR ?= $(wildcard ${ROOT_DIR}/build/docker/*)
|
||||
# Determine image files by looking into build/images/*/Dockerfile
|
||||
IMAGES_DIR ?= $(wildcard ${ROOT_DIR}/build/images/*)
|
||||
# Determine images names by stripping out the dir names
|
||||
IMAGES ?= $(filter-out tools,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user