docs: add openim images test

Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
pull/1255/head
Xinwei Xiong(cubxxw) 2 years ago
parent df50971744
commit 7e63800dee

@ -1,4 +1,4 @@
<!-- # Ignore files and directories starting with a dot
# Ignore files and directories starting with a dot
# Ignore specific files
.dockerignore
@ -29,4 +29,4 @@ assets/
components/
# Ignore tools and scripts
.github/ -->
.github/

@ -48,7 +48,7 @@ jobs:
strategy:
matrix:
go_version: ["1.18","1.19","1.20","1.21"]
go_version: ["1.19","1.20","1.21"]
os: [ubuntu-latest]
steps:

@ -0,0 +1,7 @@
FROM ghcr.io/openim-sigs/openim-bash-image:latest
WORKDIR /openim/openim-server
COPY miniblog ./bin/miniblog
ENTRYPOINT ["./bin/miniblog"]

@ -31,20 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-api
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-api /usr/bin/openim-api
# 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/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10002
EXPOSE 10002
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-api /usr/bin/openim-api
COPY --from=builder /usr/bin/openim-api ./bin/openim-api
ENTRYPOINT ["bash", "-c", "openim-api -c $OPENIM_SERVER_CONFIG_NAME --port $PORT"]
ENTRYPOINT ["./bin/openim-api"]

@ -1,8 +0,0 @@
FROM ghcr.io/openim-sigs/openim-bash-image:latest
COPY openim-api /usr/bin/
# nosemgrep: dockerfile.security.missing-user.missing-user
ENTRYPOINT ["/usr/bin/openim-api"]
# nosemgrep: dockerfile.security.missing-user.missing-user
CMD ["--help"]

@ -31,19 +31,15 @@ RUN go mod download
COPY . .
RUN go mod download
RUN make clean
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-api
FROM ghcr.io/openim-sigs/openim-bash-image:latest
WORKDIR /openim/openim-server
COPY --from=builder $OPENIM_SERVER_BINDIR/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder ${SERVER_WORKDIR}/config /openim/openim-server/config
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-cmdutils /usr/bin/openim-cmdutils
COPY --from=builder /usr/bin/openim-cmdutils ./bin/openim-cmdutils
ENTRYPOINT ["openim-cmdutils"]
ENTRYPOINT ["./bin/openim-cmdutils"]
CMD ["--help"]

@ -31,18 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-crontask
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-crontask /usr/bin/openim-crontask
# 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/platforms /openim/openim-server/_output/bin/platforms
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)/openim-crontask /usr/bin/openim-crontask
COPY --from=builder /usr/bin/openim-crontask ./bin/openim-crontask
CMD ["bash", "-c", "openim-crontask -c $OPENIM_SERVER_CONFIG_NAME"]
ENTRYPOINT ["./bin/openim-crontask"]

@ -31,22 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-msggateway
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-msggateway /usr/bin/openim-msggateway
# 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/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10140 \
WS_PORT 10001
EXPOSE 10140
EXPOSE 10001
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msggateway /usr/bin/openim-msggateway
COPY --from=builder /usr/bin/openim-msggateway ./bin/openim-msggateway
CMD ["bash", "-c", "openim-msggateway -c $OPENIM_SERVER_CONFIG_NAME --port $PORT --ws_port $WS_PORT"]
ENTRYPOINT ["./bin/openim-msggateway"]

@ -31,16 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-msgtransfer
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-msgtransfer /usr/bin/openim-msgtransfer
# 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/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-msgtransfer /usr/bin/openim-msgtransfer
COPY --from=builder /usr/bin/openim-msgtransfer ./bin/openim-msgtransfer
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then openim-msgtransfer -c $OPENIM_SERVER_CONFIG_NAME --prometheus_port $PROMETHEUS_PORT; else openim-msgtransfer -c $OPENIM_SERVER_CONFIG_NAME; fi"]
ENTRYPOINT ["./bin/openim-msgtransfer"]

@ -15,7 +15,6 @@
# OpenIM base image: https://github.com/openim-sigs/openim-base-image
# Set go mod installation source and proxy
# docker run -e "PORT=10003" -e "PROMETHEUSORT=4321" --network host -it 67ef891ad1ff
FROM golang:1.20 AS builder
@ -32,21 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-push
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-push /usr/bin/openim-push
# 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/platforms /openim/openim-server/_output/bin/platforms
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10170 \
PROMETHEUS_PORT 20170
EXPOSE 10170
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-push /usr/bin/openim-push
COPY --from=builder /usr/bin/openim-push ./bin/openim-push
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then openim-push -c $OPENIM_SERVER_CONFIG_NAME --port $PORT --prometheus_port $PROMETHEUS_PORT; else openim-push -c $OPENIM_SERVER_CONFIG_NAME --port $PORT; fi"]
ENTRYPOINT ["./bin/openim-push"]

@ -31,22 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-rpc-auth
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-auth /usr/bin/openim-rpc-auth
# 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/platforms /openim/openim-server/_output/bin/platforms/
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10160 \
PROMETHEUS_PORT 20160
EXPOSE 10160
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-auth /usr/bin/openim-rpc-auth
COPY --from=builder /usr/bin/openim-rpc-auth ./bin/openim-rpc-auth
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-auth --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-auth --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-auth"]

@ -31,22 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-rpc-conversation
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-conversation /usr/bin/openim-rpc-conversation
# 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/platforms /openim/openim-server/_output/bin/platforms/
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10230 \
PROMETHEUS_PORT 20230
EXPOSE 10230
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-conversation /usr/bin/openim-rpc-conversation
COPY --from=builder /usr/bin/openim-rpc-conversation ./bin/openim-rpc-conversation
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-conversation --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-conversation --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-conversation"]

@ -31,22 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-rpc-friend
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-friend /usr/bin/openim-rpc-friend
# 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/platforms /openim/openim-server/_output/bin/platforms/
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10120 \
PROMETHEUS_PORT 20120
EXPOSE 10120
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-friend /usr/bin/openim-rpc-friend
COPY --from=builder /usr/bin/openim-rpc-friend ./bin/openim-rpc-friend
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-friend --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-friend --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-friend"]

@ -31,22 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-rpc-group
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-group /usr/bin/openim-rpc-group
# 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/platforms /openim/openim-server/_output/bin/platforms/
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10150 \
PROMETHEUS_PORT 20150
EXPOSE 10150
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-group /usr/bin/openim-rpc-group
COPY --from=builder /usr/bin/openim-rpc-group ./bin/openim-rpc-group
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-group --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-group --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-group"]

@ -31,22 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-rpc-msg
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-msg /usr/bin/openim-rpc-msg
# 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/platforms /openim/openim-server/_output/bin/platforms/
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10130 \
PROMETHEUS_PORT 20130
EXPOSE 10130
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-msg /usr/bin/openim-rpc-msg
COPY --from=builder /usr/bin/openim-rpc-msg ./bin/openim-rpc-msg
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-msg --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-msg --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-msg"]

@ -31,23 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-rpc-third
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-third /usr/bin/openim-rpc-third
# 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/platforms /openim/openim-server/_output/bin/platforms/
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10190 \
PROMETHEUS_PORT 21301
EXPOSE 10190
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-third /usr/bin/openim-rpc-third
COPY --from=builder /usr/bin/openim-rpc-third ./bin/openim-rpc-third
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-third --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-third --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-third"]

@ -31,22 +31,15 @@ RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=openim-rpc-user
RUN cp /openim/openim-server/_output/bin/platforms/$(go env GOOS)/$(go env GOARCH)/openim-rpc-user /usr/bin/openim-rpc-user
# 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/platforms /openim/openim-server/_output/bin/platforms/
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV PORT 10110 \
PROMETHEUS_PORT 20110
EXPOSE 10110
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-rpc-user /usr/bin/openim-rpc-user
COPY --from=builder /usr/bin/openim-rpc-user ./bin/openim-rpc-user
ENTRYPOINT ["bash", "-c", "if [[ -n $PROMETHEUS_PORT ]]; then "openim-rpc-user --port $PORT -c $OPENIM_SERVER_CONFIG_NAME" --prometheus_port $PROMETHEUS_PORT; else "openim-rpc-user --port $PORT -c $OPENIM_SERVER_CONFIG_NAME"; fi"]
ENTRYPOINT ["./bin/openim-rpc-user"]

@ -1,6 +1,6 @@
module github.com/openimsdk/open-im-server/v3
go 1.18
go 1.19
require (
firebase.google.com/go v3.13.0+incompatible

@ -1,4 +1,4 @@
go 1.18
go 1.19
use (
.

@ -17,7 +17,7 @@
#
GO := go
GO_SUPPORTED_VERSIONS ?= 1.18|1.19|1.20|1.21|1.22
GO_SUPPORTED_VERSIONS ?= 1.19|1.20|1.21|1.22
GO_LDFLAGS += -X $(VERSION_PACKAGE).gitVersion=$(GIT_TAG) \
-X $(VERSION_PACKAGE).gitCommit=$(GIT_COMMIT) \

@ -1,6 +1,6 @@
module github.com/openimsdk/open-im-server/test/typecheck
go 1.18
go 1.19
require golang.org/x/tools v0.12.0

@ -1,22 +0,0 @@
package tests
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/controller"
)
func TestDeleteGroupMemberHash(t *testing.T) {
mockGroupDB := new(controller.MockGroupDatabase)
testGroupMemberHash := "testGroupMemberHash"
err := mockGroupDB.DeleteGroupMemberHash(testGroupMemberHash)
assert.Nil(t, err)
nonExistentGroupMemberHash := "nonExistentGroupMemberHash"
err = mockGroupDB.DeleteGroupMemberHash(nonExistentGroupMemberHash)
assert.NotNil(t, err)
}

@ -1,51 +0,0 @@
package cache_test
import (
"reflect"
"testing"
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
)
func TestRemoveRepeatedElementsInList(t *testing.T) {
testCases := []struct {
name string
input []string
expected []string
}{
{
name: "No duplicates",
input: []string{"a", "b", "c"},
expected: []string{"a", "b", "c"},
},
{
name: "All duplicates",
input: []string{"a", "a", "a"},
expected: []string{"a"},
},
{
name: "Some duplicates",
input: []string{"a", "b", "a", "c", "b"},
expected: []string{"a", "b", "c"},
},
{
name: "Empty list",
input: []string{},
expected: []string{},
},
{
name: "Single element",
input: []string{"a"},
expected: []string{"a"},
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
result := cache.RemoveRepeatedElementsInList(tc.input)
if !reflect.DeepEqual(result, tc.expected) {
t.Errorf("expected %v, got %v", tc.expected, result)
}
})
}
}

@ -1,3 +1,3 @@
module github.com/openimsdk/open-im-server/v3/tools/changelog
go 1.18
go 1.19

@ -1,3 +1,3 @@
module github.com/openimsdk/open-im-server/v3/tools/component
go 1.18
go 1.19

@ -1,6 +1,6 @@
module github.com/openimsdk/open-im-server/v3/tools/data-conversion
go 1.18
go 1.19
require (
github.com/IBM/sarama v1.41.2

@ -1,6 +1,6 @@
module github.com/openimsdk/open-im-server/v3/tools/imctl
go 1.18
go 1.19
require (
github.com/MakeNowJust/heredoc/v2 v2.0.1

@ -1,3 +1,3 @@
module github.com/openimsdk/open-im-server/v3/tools/infra
go 1.18
go 1.19

@ -1,5 +1,5 @@
module github.com/openimsdk/open-im-server/v3/tools/ncpu
go 1.18
go 1.19
require go.uber.org/automaxprocs v1.5.3

@ -1,6 +1,6 @@
module github.com/openimsdk/open-im-server/v3/tools/openim-web
go 1.18
go 1.19
require gopkg.in/yaml.v2 v2.4.0

@ -1,3 +1,3 @@
module github.com/openimsdk/open-im-server/v3/tools/versionchecker
go 1.18
go 1.19

@ -1,6 +1,6 @@
module github.com/openimsdk/open-im-server/v3/tools/yamlfmt
go 1.18
go 1.19
require (
github.com/likexian/gokit v0.25.13

Loading…
Cancel
Save