mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-10-26 13:12:12 +08:00
build: implement services image build.
This commit is contained in:
parent
14477321fd
commit
d77e58bddb
91
.github/workflows/build-and-release-services-images.yml
vendored
Normal file
91
.github/workflows/build-and-release-services-images.yml
vendored
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
name: Build and release services Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- release-*
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description: "Tag version to be used for Docker image"
|
||||||
|
required: true
|
||||||
|
default: "v3.8.3"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Log in to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Log in to Aliyun Container Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: registry.cn-hangzhou.aliyuncs.com
|
||||||
|
username: ${{ secrets.ALIREGISTRY_USERNAME }}
|
||||||
|
password: ${{ secrets.ALIREGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Extract metadata for Docker (tags, labels)
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
tags: |
|
||||||
|
type=ref,event=tag
|
||||||
|
type=schedule
|
||||||
|
type=ref,event=branch
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern=v{{version}}
|
||||||
|
# type=semver,pattern={{major}}.{{minor}}
|
||||||
|
type=semver,pattern=release-{{raw}}
|
||||||
|
type=sha
|
||||||
|
type=raw,value=${{ github.event.inputs.tag }}
|
||||||
|
|
||||||
|
- name: Build and push Docker images
|
||||||
|
run: |
|
||||||
|
ROOT_DIR="build/images"
|
||||||
|
for dir in "$ROOT_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 "$dir"
|
||||||
|
else
|
||||||
|
echo "No valid Dockerfile found in $dir"
|
||||||
|
fi
|
||||||
|
done
|
||||||
@ -43,7 +43,7 @@ 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.mod $SERVER_DIR/
|
||||||
COPY --from=builder $SERVER_DIR/go.sum $SERVER_DIR/
|
COPY --from=builder $SERVER_DIR/go.sum $SERVER_DIR/
|
||||||
|
|
||||||
RUN go get github.com/openimsdk/gomake@v0.0.14-alpha.5
|
RUN go get github.com/openimsdk/gomake@v0.0.15-alpha.1
|
||||||
|
|
||||||
# Set the command to run when the container starts
|
# Set the command to run when the container starts
|
||||||
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
||||||
|
|||||||
@ -1,24 +1,24 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# # Copyright © 2023 OpenIM. All rights reserved.
|
||||||
#
|
# #
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# # Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# # you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# # You may obtain a copy of the License at
|
||||||
#
|
# #
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# # http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
# #
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# # Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# # distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# # See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# # limitations under the License.
|
||||||
|
|
||||||
FROM BASE_IMAGE
|
# FROM BASE_IMAGE
|
||||||
|
|
||||||
WORKDIR ${SERVER_WORKDIR}
|
# WORKDIR ${SERVER_WORKDIR}
|
||||||
|
|
||||||
# Set HTTP proxy
|
# # Set HTTP proxy
|
||||||
ARG BINARY_NAME
|
# ARG BINARY_NAME
|
||||||
|
|
||||||
COPY BINARY_NAME ./bin/BINARY_NAME
|
# COPY BINARY_NAME ./bin/BINARY_NAME
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/BINARY_NAME"]
|
# ENTRYPOINT ["./bin/BINARY_NAME"]
|
||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# 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
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-api
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-api /usr/bin/openim-api
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-api
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-api ./bin/openim-api
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-api"]
|
# 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 echo -e "serviceBinaries:\n openim-api: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +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
|
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN make build BINS=openim-cmdutils
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-cmdutils /usr/bin/openim-cmdutils
|
|
||||||
|
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-cmdutils ./bin/openim-cmdutils
|
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-cmdutils"]
|
|
||||||
|
|
||||||
CMD ["--help"]
|
|
||||||
@ -1,44 +1,58 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# 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
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-crontask
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-crontask /usr/bin/openim-crontask
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-crontask
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-crontask ./bin/openim-crontask
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-crontask"]
|
# 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 openim-crontask: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,58 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# 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
|
# Define the base directory for the application as an environment variable
|
||||||
|
ENV SERVER_DIR=/openim-server
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-msggateway
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-msggateway /usr/bin/openim-msggateway
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-msggateway
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-msggateway ./bin/openim-msggateway
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-msggateway"]
|
# 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 openim-msggateway: 1 \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/mo3et/gomake@v0.0.74
|
||||||
|
|
||||||
|
# Set the command to run when the container starts
|
||||||
|
ENTRYPOINT ["sh", "-c", "mage start && tail -f /dev/null"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-msgtransfer
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-msgtransfer /usr/bin/openim-msgtransfer
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-msgtransfer
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-msgtransfer ./bin/openim-msgtransfer
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-msgtransfer"]
|
# 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 openim-msgtransfer: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-push
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-push /usr/bin/openim-push
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-push
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-push ./bin/openim-push
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-push"]
|
# 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 openim-push: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-rpc-auth
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth /usr/bin/openim-rpc-auth
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-rpc-auth
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-rpc-auth ./bin/openim-rpc-auth
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-rpc-auth"]
|
# 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 openim-rpc-auth: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-rpc-conversation
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation /usr/bin/openim-rpc-conversation
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-rpc-conversation
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-rpc-conversation ./bin/openim-rpc-conversation
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-rpc-conversation"]
|
# 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 openim-rpc-conversation: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-rpc-friend
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend /usr/bin/openim-rpc-friend
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-rpc-friend
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-rpc-friend ./bin/openim-rpc-friend
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-rpc-friend"]
|
# 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 openim-rpc-friend: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-rpc-group
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group /usr/bin/openim-rpc-group
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-rpc-group
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-rpc-group ./bin/openim-rpc-group
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-rpc-group"]
|
# 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 openim-rpc-group: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-rpc-msg
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg /usr/bin/openim-rpc-msg
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-rpc-msg
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-rpc-msg ./bin/openim-rpc-msg
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-rpc-msg"]
|
# 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 openim-rpc-msg: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-rpc-third
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third /usr/bin/openim-rpc-third
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-rpc-third
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-rpc-third ./bin/openim-rpc-third
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-rpc-third"]
|
# 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 openim-rpc-third: 1 \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"]
|
||||||
|
|||||||
@ -1,44 +1,57 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# Use Go 1.22 Alpine as the base image for building the application
|
||||||
#
|
FROM golang:1.22-alpine AS builder
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Define the base directory for the application as an environment variable
|
||||||
# you may not use this file except in compliance with the License.
|
ENV SERVER_DIR=/openim-server
|
||||||
# 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 the working directory inside the container based on the environment variable
|
||||||
|
WORKDIR $SERVER_DIR
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# Set the Go proxy to improve dependency resolution speed
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
ENV GOPROXY=https://goproxy.io,direct
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
|
||||||
ENV GOPROXY=$GOPROXY
|
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
|
# Copy all files from the current directory into the container
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN make build BINS=openim-rpc-user
|
RUN go mod download
|
||||||
|
|
||||||
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user /usr/bin/openim-rpc-user
|
# Install Mage to use for building the application
|
||||||
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
ENV BINS=openim-rpc-user
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# Optionally build your application if needed
|
||||||
|
RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
|
||||||
COPY --from=builder /usr/bin/openim-rpc-user ./bin/openim-rpc-user
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
ENTRYPOINT ["./bin/openim-rpc-user"]
|
# 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 openim-rpc-user: 1 \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"]
|
||||||
|
|||||||
@ -1,48 +1,108 @@
|
|||||||
# Copyright © 2023 OpenIM. All rights reserved.
|
# # Copyright © 2023 OpenIM. All rights reserved.
|
||||||
#
|
# #
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# # Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
# you may not use this file except in compliance with the License.
|
# # you may not use this file except in compliance with the License.
|
||||||
# You may obtain a copy of the License at
|
# # You may obtain a copy of the License at
|
||||||
#
|
# #
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
# # http://www.apache.org/licenses/LICENSE-2.0
|
||||||
#
|
# #
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
# # Unless required by applicable law or agreed to in writing, software
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
# # distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# # See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# # limitations under the License.
|
||||||
|
|
||||||
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
# # OpenIM base image: https://github.com/openim-sigs/openim-base-image
|
||||||
|
|
||||||
# Set go mod installation source and proxy
|
# # Set go mod installation source and proxy
|
||||||
|
|
||||||
FROM golang:1.20 AS builder
|
# FROM golang:1.20 AS builder
|
||||||
|
|
||||||
ARG GO111MODULE=on
|
#
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# WORKDIR /openim/openim-server
|
||||||
|
|
||||||
ENV GO111MODULE=$GO111MODULE
|
#
|
||||||
ENV GOPROXY=$GOPROXY
|
# ENV GOPROXY=$GOPROXY
|
||||||
|
|
||||||
COPY go.mod go.sum ./
|
# COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
# 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 . .
|
COPY . .
|
||||||
|
|
||||||
RUN make clean
|
RUN go mod download
|
||||||
RUN make build BINS=component
|
|
||||||
|
|
||||||
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
# Install Mage to use for building the application
|
||||||
FROM ghcr.io/openim-sigs/openim-bash-image:latest
|
RUN go install github.com/magefile/mage@v1.15.0
|
||||||
|
|
||||||
WORKDIR /openim/openim-server
|
# ENV BINS=openim-rpc-user
|
||||||
|
|
||||||
COPY --from=builder /openim/openim-server/_output/bin/tools /openim/openim-server/_output/bin/tools/
|
# Optionally build your application if needed
|
||||||
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
|
# RUN mage build ${BINS} check-free-memory seq || true
|
||||||
|
RUN mage build check-free-memory seq || true
|
||||||
|
|
||||||
ENV OPENIM_SERVER_CONFIG_NAME=/openim/openim-server/config
|
# Using Alpine Linux with Go environment for the final image
|
||||||
|
FROM golang:1.22-alpine
|
||||||
|
|
||||||
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/component /usr/bin/component
|
# Install necessary packages, such as bash
|
||||||
|
RUN apk add bash
|
||||||
|
|
||||||
ENTRYPOINT ["bash", "-c", "component -c $OPENIM_SERVER_CONFIG_NAME"]
|
# 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"]
|
||||||
|
|||||||
2
go.mod
2
go.mod
@ -37,7 +37,7 @@ require (
|
|||||||
github.com/hashicorp/golang-lru/v2 v2.0.7
|
github.com/hashicorp/golang-lru/v2 v2.0.7
|
||||||
github.com/kelindar/bitmap v1.5.2
|
github.com/kelindar/bitmap v1.5.2
|
||||||
github.com/likexian/gokit v0.25.13
|
github.com/likexian/gokit v0.25.13
|
||||||
github.com/openimsdk/gomake v0.0.14-alpha.5
|
github.com/openimsdk/gomake v0.0.15-alpha.1
|
||||||
github.com/redis/go-redis/v9 v9.4.0
|
github.com/redis/go-redis/v9 v9.4.0
|
||||||
github.com/robfig/cron/v3 v3.0.1
|
github.com/robfig/cron/v3 v3.0.1
|
||||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||||
|
|||||||
4
go.sum
4
go.sum
@ -317,8 +317,8 @@ github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
|||||||
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
|
||||||
github.com/onsi/gomega v1.25.0 h1:Vw7br2PCDYijJHSfBOWhov+8cAnUf8MfMaIOV323l6Y=
|
github.com/onsi/gomega v1.25.0 h1:Vw7br2PCDYijJHSfBOWhov+8cAnUf8MfMaIOV323l6Y=
|
||||||
github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
|
github.com/onsi/gomega v1.25.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM=
|
||||||
github.com/openimsdk/gomake v0.0.14-alpha.5 h1:VY9c5x515lTfmdhhPjMvR3BBRrRquAUCFsz7t7vbv7Y=
|
github.com/openimsdk/gomake v0.0.15-alpha.1 h1:a3U0gayzEJJucOoIOt9Jju+HQTG2BtKcuLG4AVjeVF4=
|
||||||
github.com/openimsdk/gomake v0.0.14-alpha.5/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
|
github.com/openimsdk/gomake v0.0.15-alpha.1/go.mod h1:PndCozNc2IsQIciyn9mvEblYWZwJmAI+06z94EY+csI=
|
||||||
github.com/openimsdk/protocol v0.0.72-alpha.59 h1:+ycb2+68mLKPIo7VrxF0id/GXP6OqZ2/nBM1YZQr7qY=
|
github.com/openimsdk/protocol v0.0.72-alpha.59 h1:+ycb2+68mLKPIo7VrxF0id/GXP6OqZ2/nBM1YZQr7qY=
|
||||||
github.com/openimsdk/protocol v0.0.72-alpha.59/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M=
|
github.com/openimsdk/protocol v0.0.72-alpha.59/go.mod h1:Iet+piS/jaS+kWWyj6EEr36mk4ISzIRYjoMSVA4dq2M=
|
||||||
github.com/openimsdk/tools v0.0.50-alpha.38 h1:AU6/cvDfN4ciIOwAj8IWEwze3DeEp2cHYPgW3y0OlbU=
|
github.com/openimsdk/tools v0.0.50-alpha.38 h1:AU6/cvDfN4ciIOwAj8IWEwze3DeEp2cHYPgW3y0OlbU=
|
||||||
|
|||||||
13
magefile.go
13
magefile.go
@ -4,14 +4,23 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/openimsdk/gomake/mageutil"
|
"flag"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/openimsdk/gomake/mageutil"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Default = Build
|
var Default = Build
|
||||||
|
|
||||||
func Build() {
|
func Build() {
|
||||||
mageutil.Build()
|
flag.Parse()
|
||||||
|
|
||||||
|
bin := flag.Args()
|
||||||
|
if len(bin) != 0 {
|
||||||
|
bin = bin[1:]
|
||||||
|
}
|
||||||
|
|
||||||
|
mageutil.Build(bin)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Start() {
|
func Start() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user