mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-06-05 21:08:27 +08:00
refactor(ci): actions and dockerfile (#3732)
* feat(build): add unified server image build flow Consolidate service image definitions into a single server build setup, and update CI workflows to use it. * fix(ci): correct Docker image tag generation
This commit is contained in:
parent
9118b3a339
commit
8f913ca13b
@ -16,11 +16,17 @@ on:
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3.3.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3.8.0
|
||||
|
||||
@ -44,48 +50,63 @@ jobs:
|
||||
username: ${{ secrets.ALIREGISTRY_USERNAME }}
|
||||
password: ${{ secrets.ALIREGISTRY_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Docker (tags, labels)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5.6.0
|
||||
with:
|
||||
tags: |
|
||||
type=ref,event=tag
|
||||
type=schedule
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=release-{{raw}}
|
||||
type=sha
|
||||
type=raw,value=${{ github.event.inputs.tag }}
|
||||
- name: Resolve Docker image tags
|
||||
id: tags
|
||||
env:
|
||||
INPUT_TAG: ${{ github.event.inputs.tag }}
|
||||
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
tags=()
|
||||
declare -A seen=()
|
||||
|
||||
add_tag() {
|
||||
local tag="$1"
|
||||
[[ -n "$tag" ]] || return 0
|
||||
|
||||
tag="${tag//\//-}"
|
||||
if [[ -z "${seen[$tag]+x}" ]]; then
|
||||
tags+=("$tag")
|
||||
seen["$tag"]=1
|
||||
fi
|
||||
}
|
||||
|
||||
add_tag_with_semver_alias() {
|
||||
local tag="$1"
|
||||
add_tag "$tag"
|
||||
if [[ "$tag" =~ ^v([0-9]+\.[0-9]+\.[0-9]+.*)$ ]]; then
|
||||
add_tag "${BASH_REMATCH[1]}"
|
||||
add_tag "release-$tag"
|
||||
fi
|
||||
}
|
||||
|
||||
add_tag_with_semver_alias "${INPUT_TAG:-}"
|
||||
add_tag_with_semver_alias "${RELEASE_TAG:-}"
|
||||
|
||||
if [[ "${GITHUB_REF_TYPE:-}" == "tag" ]]; then
|
||||
add_tag_with_semver_alias "${GITHUB_REF_NAME}"
|
||||
elif [[ "${GITHUB_REF_TYPE:-}" == "branch" ]]; then
|
||||
add_tag "${GITHUB_REF_NAME}"
|
||||
fi
|
||||
|
||||
add_tag "sha-${GITHUB_SHA::7}"
|
||||
|
||||
{
|
||||
echo "tags<<EOF"
|
||||
printf '%s\n' "${tags[@]}"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push Docker images
|
||||
env:
|
||||
RELEASE: "true"
|
||||
PUSH: "true"
|
||||
PLATFORMS: linux/amd64,linux/arm64
|
||||
IMAGE_TAGS: ${{ steps.tags.outputs.tags }}
|
||||
IMAGE_REGISTRIES: |
|
||||
${{ secrets.DOCKER_USERNAME }}
|
||||
ghcr.io/${{ github.repository_owner }}
|
||||
registry.cn-hangzhou.aliyuncs.com/openimsdk
|
||||
run: |
|
||||
IMG_DIR="build/images"
|
||||
for dir in "$IMG_DIR"/*/; do
|
||||
# Find Dockerfile or *.dockerfile in a case-insensitive manner
|
||||
dockerfile=$(find "$dir" -maxdepth 1 -type f \( -iname 'dockerfile' -o -iname '*.dockerfile' \) | head -n 1)
|
||||
|
||||
if [ -n "$dockerfile" ] && [ -f "$dockerfile" ]; then
|
||||
IMAGE_NAME=$(basename "$dir")
|
||||
echo "Building Docker image for $IMAGE_NAME with tags:"
|
||||
|
||||
# Initialize tag arguments
|
||||
tag_args=()
|
||||
|
||||
# Read each tag and append --tag arguments
|
||||
while IFS= read -r tag; do
|
||||
tag_args+=(--tag "${{ secrets.DOCKER_USERNAME }}/$IMAGE_NAME:$tag")
|
||||
tag_args+=(--tag "ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME:$tag")
|
||||
tag_args+=(--tag "registry.cn-hangzhou.aliyuncs.com/openimsdk/$IMAGE_NAME:$tag")
|
||||
done <<< "${{ steps.meta.outputs.tags }}"
|
||||
|
||||
# Build and push the Docker image with all tags
|
||||
docker buildx build --platform linux/amd64,linux/arm64 \
|
||||
--file "$dockerfile" \
|
||||
"${tag_args[@]}" \
|
||||
--push \
|
||||
"."
|
||||
else
|
||||
echo "No valid Dockerfile found in $dir"
|
||||
fi
|
||||
done
|
||||
bash build/build.sh
|
||||
|
||||
6
.github/workflows/go-build-test.yml
vendored
6
.github/workflows/go-build-test.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
go_version: ["1.22.x"]
|
||||
go_version: ["1.25.x"]
|
||||
|
||||
steps:
|
||||
- name: Checkout Server repository
|
||||
@ -188,7 +188,7 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
go_version: ["1.22.x"]
|
||||
go_version: ["1.25.x"]
|
||||
|
||||
steps:
|
||||
- name: Checkout Server repository
|
||||
@ -237,7 +237,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go_version: ["1.22"]
|
||||
go_version: ["1.25.x"]
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
|
||||
54
Dockerfile
54
Dockerfile
@ -1,49 +1,25 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
ARG RELEASE=false
|
||||
ARG COMPRESS=false
|
||||
WORKDIR /openim-server
|
||||
|
||||
# Set the working directory inside the container based on the environment variable
|
||||
WORKDIR $SERVER_DIR
|
||||
RUN apk add --no-cache upx
|
||||
|
||||
# Set the Go proxy to improve dependency resolution speed
|
||||
# ENV GOPROXY=https://goproxy.io,direct
|
||||
RUN go install github.com/magefile/mage@latest
|
||||
|
||||
# Copy all files from the current directory into the container
|
||||
COPY . .
|
||||
|
||||
RUN go mod download
|
||||
RUN RELEASE=${RELEASE} COMPRESS=${COMPRESS} mage build
|
||||
RUN mage -compile ./mage -ldflags "-s -w"
|
||||
|
||||
# Install Mage to use for building the application
|
||||
RUN go install github.com/magefile/mage@v1.15.0
|
||||
FROM alpine:latest
|
||||
|
||||
# Optionally build your application if needed
|
||||
RUN mage build
|
||||
WORKDIR /openim-server
|
||||
|
||||
# Using Alpine Linux with Go environment for the final image
|
||||
FROM golang:1.22-alpine
|
||||
COPY --from=builder /openim-server/_output ./_output
|
||||
COPY --from=builder /openim-server/config ./config
|
||||
COPY --from=builder /openim-server/start-config.yml ./start-config.yml
|
||||
COPY --from=builder /openim-server/mage ./mage
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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/
|
||||
|
||||
RUN go get github.com/openimsdk/gomake@v0.0.15-alpha.1
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
||||
ENTRYPOINT ["sh", "-c", "./mage start && sleep infinity"]
|
||||
133
build/build.sh
Executable file
133
build/build.sh
Executable file
@ -0,0 +1,133 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CYAN='\033[0;36m'
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
NO_COLOR='\033[0m'
|
||||
|
||||
BASE_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
COMPOSE_FILE="$BASE_DIR/images/openim-server/docker-compose.build.yml"
|
||||
RELEASE="${RELEASE:-false}"
|
||||
PUSH="${PUSH:-false}"
|
||||
DRY_RUN="${DRY_RUN:-false}"
|
||||
PLATFORMS="${PLATFORMS:-linux/amd64,linux/arm64}"
|
||||
IMAGE_TAGS="${IMAGE_TAGS:-}"
|
||||
IMAGE_REGISTRIES="${IMAGE_REGISTRIES:-}"
|
||||
|
||||
if [[ ! -f "$COMPOSE_FILE" ]]; then
|
||||
echo -e "${RED}docker-compose.build.yml not found: $COMPOSE_FILE${NO_COLOR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd "$BASE_DIR/.." || exit 1
|
||||
|
||||
split_values() {
|
||||
printf '%s\n' "$1" | tr ', ' '\n\n' | while IFS= read -r value; do
|
||||
[[ -n "$value" ]] && printf '%s\n' "$value"
|
||||
done
|
||||
}
|
||||
|
||||
print_command() {
|
||||
printf '%q ' "$@"
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
run_or_print() {
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
print_command "$@"
|
||||
else
|
||||
"$@"
|
||||
fi
|
||||
}
|
||||
|
||||
build_local() {
|
||||
echo -e "${CYAN}Building all services...${NO_COLOR}"
|
||||
RELEASE="$RELEASE" docker compose -f "$COMPOSE_FILE" build
|
||||
|
||||
echo -e "${CYAN}Tagging compatibility images for Kubernetes...${NO_COLOR}"
|
||||
while IFS= read -r built_image; do
|
||||
[[ -n "$built_image" ]] || continue
|
||||
compatibility_tag="${built_image##*/}"
|
||||
|
||||
if [[ "$built_image" != "$compatibility_tag" ]]; then
|
||||
docker tag "$built_image" "$compatibility_tag"
|
||||
fi
|
||||
done < <(docker compose -f "$COMPOSE_FILE" config --images)
|
||||
|
||||
echo -e "${GREEN}Successfully built all services${NO_COLOR}"
|
||||
}
|
||||
|
||||
build_push() {
|
||||
if ! command -v jq >/dev/null 2>&1; then
|
||||
echo -e "${RED}jq is required for PUSH=true${NO_COLOR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z "$IMAGE_TAGS" || -z "$IMAGE_REGISTRIES" ]]; then
|
||||
echo -e "${RED}IMAGE_TAGS and IMAGE_REGISTRIES are required for PUSH=true${NO_COLOR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
image_tags=()
|
||||
while IFS= read -r tag; do
|
||||
image_tags+=("$tag")
|
||||
done < <(split_values "$IMAGE_TAGS")
|
||||
|
||||
image_registries=()
|
||||
while IFS= read -r registry; do
|
||||
image_registries+=("$registry")
|
||||
done < <(split_values "$IMAGE_REGISTRIES")
|
||||
|
||||
if [[ ${#image_tags[@]} -eq 0 || ${#image_registries[@]} -eq 0 ]]; then
|
||||
echo -e "${RED}IMAGE_TAGS and IMAGE_REGISTRIES must contain at least one value${NO_COLOR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
compose_config=$(docker compose -f "$COMPOSE_FILE" config --format json)
|
||||
|
||||
echo -e "${CYAN}Building and pushing service images...${NO_COLOR}"
|
||||
while IFS= read -r service; do
|
||||
context=$(jq -r --arg service "$service" '.services[$service].build.context // empty' <<< "$compose_config")
|
||||
dockerfile=$(jq -r --arg service "$service" '.services[$service].build.dockerfile // empty' <<< "$compose_config")
|
||||
cmd_path=$(jq -r --arg service "$service" '.services[$service].build.args.CMD_PATH // empty' <<< "$compose_config")
|
||||
binary_name=$(jq -r --arg service "$service" '.services[$service].build.args.BINARY_NAME // empty' <<< "$compose_config")
|
||||
|
||||
if [[ -z "$context" || -z "$dockerfile" || -z "$cmd_path" || -z "$binary_name" ]]; then
|
||||
echo -e "${RED}Invalid build config for $service${NO_COLOR}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "$cmd_path" && ! -f "$cmd_path/main.go" ]]; then
|
||||
echo -e "${CYAN}Skipping $service because $cmd_path does not exist${NO_COLOR}"
|
||||
continue
|
||||
fi
|
||||
|
||||
tag_args=()
|
||||
for registry in "${image_registries[@]}"; do
|
||||
for tag in "${image_tags[@]}"; do
|
||||
tag_args+=(--tag "$registry/$binary_name:$tag")
|
||||
done
|
||||
done
|
||||
|
||||
echo -e "${CYAN}Building $binary_name for $PLATFORMS...${NO_COLOR}"
|
||||
run_or_print docker buildx build \
|
||||
--platform "$PLATFORMS" \
|
||||
--file "$dockerfile" \
|
||||
--build-arg "CMD_PATH=$cmd_path" \
|
||||
--build-arg "BINARY_NAME=$binary_name" \
|
||||
--build-arg "RELEASE=$RELEASE" \
|
||||
"${tag_args[@]}" \
|
||||
--push \
|
||||
"$context"
|
||||
done < <(jq -r '.services | keys[]' <<< "$compose_config" | sort)
|
||||
|
||||
echo -e "${GREEN}Successfully pushed service images${NO_COLOR}"
|
||||
}
|
||||
|
||||
if [[ "$PUSH" == "true" ]]; then
|
||||
build_push
|
||||
else
|
||||
build_local
|
||||
fi
|
||||
@ -1,24 +0,0 @@
|
||||
# # Copyright © 2023 OpenIM. 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.
|
||||
|
||||
# FROM BASE_IMAGE
|
||||
|
||||
# WORKDIR ${SERVER_WORKDIR}
|
||||
|
||||
# # Set HTTP proxy
|
||||
# ARG BINARY_NAME
|
||||
|
||||
# COPY BINARY_NAME ./bin/BINARY_NAME
|
||||
|
||||
# ENTRYPOINT ["./bin/BINARY_NAME"]
|
||||
@ -1,36 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
RUN go build -o _output/openim-api ./cmd/openim-api
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-api"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-crontask ./cmd/openim-crontask
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-crontask"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-msggateway ./cmd/openim-msggateway
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-msggateway"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-msgtransfer ./cmd/openim-msgtransfer
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-msgtransfer"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-push ./cmd/openim-push
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-push"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-rpc-auth ./cmd/openim-rpc/openim-rpc-auth
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-auth"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-rpc-conversation ./cmd/openim-rpc/openim-rpc-conversation
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-conversation"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-rpc-friend ./cmd/openim-rpc/openim-rpc-friend
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-friend"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-rpc-group ./cmd/openim-rpc/openim-rpc-group
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-group"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-rpc-msg ./cmd/openim-rpc/openim-rpc-msg
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-msg"]
|
||||
@ -1,39 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
|
||||
|
||||
RUN go build -o _output/openim-rpc-third ./cmd/openim-rpc/openim-rpc-third
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-third"]
|
||||
@ -1,37 +0,0 @@
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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 tidy
|
||||
|
||||
RUN go build -o _output/openim-rpc-user ./cmd/openim-rpc/openim-rpc-user
|
||||
|
||||
|
||||
# Using Alpine Linux for the final image
|
||||
FROM alpine:latest
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "_output/openim-rpc-user"]
|
||||
30
build/images/openim-server/Dockerfile
Normal file
30
build/images/openim-server/Dockerfile
Normal file
@ -0,0 +1,30 @@
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
ARG CMD_PATH
|
||||
ARG BINARY_NAME
|
||||
ARG RELEASE=false
|
||||
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
COPY . .
|
||||
RUN go mod tidy
|
||||
|
||||
RUN if [ "$RELEASE" = "true" ]; then \
|
||||
go build -trimpath -ldflags "-s -w" -o _output/${BINARY_NAME} ./${CMD_PATH}; \
|
||||
else \
|
||||
go build -o _output/${BINARY_NAME} ./${CMD_PATH}; \
|
||||
fi
|
||||
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --no-cache bash
|
||||
|
||||
ARG BINARY_NAME
|
||||
ENV BINARY_NAME=${BINARY_NAME}
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
COPY --from=builder $SERVER_DIR/_output $SERVER_DIR/_output
|
||||
|
||||
ENTRYPOINT ["sh", "-c", "_output/${BINARY_NAME}"]
|
||||
72
build/images/openim-server/docker-compose.build.override.yml
Normal file
72
build/images/openim-server/docker-compose.build.override.yml
Normal file
@ -0,0 +1,72 @@
|
||||
services:
|
||||
openim-api:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-crontask:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-msggateway:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-msgtransfer:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-push:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-rpc-auth:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-rpc-conversation:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-rpc-friend:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-rpc-group:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-rpc-msg:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-rpc-third:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
|
||||
openim-rpc-user:
|
||||
build:
|
||||
platforms:
|
||||
- linux/amd64
|
||||
- linux/arm64
|
||||
120
build/images/openim-server/docker-compose.build.yml
Normal file
120
build/images/openim-server/docker-compose.build.yml
Normal file
@ -0,0 +1,120 @@
|
||||
services:
|
||||
openim-api:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-api
|
||||
BINARY_NAME: openim-api
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-api:test
|
||||
|
||||
openim-crontask:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-crontask
|
||||
BINARY_NAME: openim-crontask
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-crontask:test
|
||||
|
||||
openim-msggateway:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-msggateway
|
||||
BINARY_NAME: openim-msggateway
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-msggateway:test
|
||||
|
||||
openim-msgtransfer:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-msgtransfer
|
||||
BINARY_NAME: openim-msgtransfer
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-msgtransfer:test
|
||||
|
||||
openim-push:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-push
|
||||
BINARY_NAME: openim-push
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-push:test
|
||||
|
||||
openim-rpc-auth:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-rpc/openim-rpc-auth
|
||||
BINARY_NAME: openim-rpc-auth
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-rpc-auth:test
|
||||
|
||||
openim-rpc-conversation:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-rpc/openim-rpc-conversation
|
||||
BINARY_NAME: openim-rpc-conversation
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-rpc-conversation:test
|
||||
|
||||
openim-rpc-friend:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-rpc/openim-rpc-friend
|
||||
BINARY_NAME: openim-rpc-friend
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-rpc-friend:test
|
||||
|
||||
openim-rpc-group:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-rpc/openim-rpc-group
|
||||
BINARY_NAME: openim-rpc-group
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-rpc-group:test
|
||||
|
||||
openim-rpc-msg:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-rpc/openim-rpc-msg
|
||||
BINARY_NAME: openim-rpc-msg
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-rpc-msg:test
|
||||
|
||||
openim-rpc-third:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-rpc/openim-rpc-third
|
||||
BINARY_NAME: openim-rpc-third
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-rpc-third:test
|
||||
|
||||
openim-rpc-user:
|
||||
build:
|
||||
context: ../../..
|
||||
dockerfile: build/images/openim-server/Dockerfile
|
||||
args:
|
||||
CMD_PATH: cmd/openim-rpc/openim-rpc-user
|
||||
BINARY_NAME: openim-rpc-user
|
||||
RELEASE: ${RELEASE:-false}
|
||||
image: openim-rpc-user:test
|
||||
@ -1,108 +0,0 @@
|
||||
# # Copyright © 2023 OpenIM. 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.
|
||||
|
||||
# # OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||
|
||||
# # Set go mod installation source and proxy
|
||||
|
||||
# FROM golang:1.20 AS builder
|
||||
|
||||
#
|
||||
|
||||
# WORKDIR /openim/openim-server
|
||||
|
||||
#
|
||||
# ENV GOPROXY=$GOPROXY
|
||||
|
||||
# COPY go.mod go.sum ./
|
||||
# RUN go mod download
|
||||
|
||||
# COPY . .
|
||||
|
||||
# RUN make clean
|
||||
# RUN make build BINS=component
|
||||
|
||||
# # FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
||||
|
||||
# WORKDIR /openim/openim-server
|
||||
|
||||
# COPY --from=builder /openim/openim-server/_output/bin/tools /openim/openim-server/_output/bin/tools/
|
||||
# COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
||||
|
||||
# ENV OPENIM_SERVER_CONFIG_NAME=/openim/openim-server/config
|
||||
|
||||
# RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/component /usr/bin/component
|
||||
|
||||
# ENTRYPOINT ["bash", "-c", "component -c $OPENIM_SERVER_CONFIG_NAME"]
|
||||
|
||||
|
||||
# Use Go 1.22 Alpine as the base image for building the application
|
||||
FROM golang:1.22-alpine AS builder
|
||||
# Define the base directory for the application as an environment variable
|
||||
ENV SERVER_DIR=/openim-server
|
||||
|
||||
# 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
|
||||
|
||||
# Install Mage to use for building the application
|
||||
RUN go install github.com/magefile/mage@v1.15.0
|
||||
|
||||
# ENV BINS=openim-rpc-user
|
||||
|
||||
# Optionally build your application if needed
|
||||
# RUN mage build ${BINS} check-free-memory seq || true
|
||||
RUN mage build check-free-memory seq || true
|
||||
|
||||
# Using Alpine Linux with Go environment for the final image
|
||||
FROM golang:1.22-alpine
|
||||
|
||||
# Install necessary packages, such as bash
|
||||
RUN apk add bash
|
||||
|
||||
# Set the environment and work directory
|
||||
ENV SERVER_DIR=/openim-server
|
||||
WORKDIR $SERVER_DIR
|
||||
|
||||
|
||||
# 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/
|
||||
|
||||
|
||||
RUN echo -e "serviceBinaries:\n \n" \
|
||||
> $SERVER_DIR/start-config.yml && \
|
||||
echo -e "toolBinaries:\n - check-free-memory\n - seq\n" >> $SERVER_DIR/start-config.yml && \
|
||||
echo "maxFileDescriptors: 10000" >> $SERVER_DIR/start-config.yml
|
||||
|
||||
RUN go get github.com/openimsdk/gomake@v0.0.15-alpha.1
|
||||
|
||||
# Set the command to run when the container starts
|
||||
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
||||
Loading…
x
Reference in New Issue
Block a user