Skip to content

Commit

Permalink
docs: add openim images test
Browse files Browse the repository at this point in the history
Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
  • Loading branch information
cubxxw committed Oct 19, 2023
1 parent df50971 commit 7e63800
Show file tree
Hide file tree
Showing 33 changed files with 85 additions and 236 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- # Ignore files and directories starting with a dot
# Ignore files and directories starting with a dot

# Ignore specific files
.dockerignore
Expand Down Expand Up @@ -29,4 +29,4 @@ assets/
components/

# Ignore tools and scripts
.github/ -->
.github/
2 changes: 1 addition & 1 deletion .github/workflows/openimci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ghcr.io/openim-sigs/openim-bash-image:latest

WORKDIR /openim/openim-server

COPY miniblog ./bin/miniblog

ENTRYPOINT ["./bin/miniblog"]
13 changes: 4 additions & 9 deletions build/images/openim-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
8 changes: 0 additions & 8 deletions build/images/openim-api/Dockerfile.release

This file was deleted.

10 changes: 3 additions & 7 deletions build/images/openim-cmdutils/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
13 changes: 5 additions & 8 deletions build/images/openim-crontask/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
17 changes: 5 additions & 12 deletions build/images/openim-msggateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
11 changes: 5 additions & 6 deletions build/images/openim-msgtransfer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
17 changes: 5 additions & 12 deletions build/images/openim-push/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"]
17 changes: 5 additions & 12 deletions build/images/openim-rpc-auth/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
17 changes: 5 additions & 12 deletions build/images/openim-rpc-conversation/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
17 changes: 5 additions & 12 deletions build/images/openim-rpc-friend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
17 changes: 5 additions & 12 deletions build/images/openim-rpc-group/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
17 changes: 5 additions & 12 deletions build/images/openim-rpc-msg/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
16 changes: 4 additions & 12 deletions build/images/openim-rpc-third/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
17 changes: 5 additions & 12 deletions build/images/openim-rpc-user/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Loading

0 comments on commit 7e63800

Please sign in to comment.