feat: add docker buildx images is openim-web

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
v3.3.0-beta.1
Xinwei Xiong(cubxxw-openim) 2 years ago
parent e3d8962f91
commit 484a6fea60
No known key found for this signature in database
GPG Key ID: 1BAD6F395338EFDE

@ -318,3 +318,68 @@ jobs:
labels: ${{ steps.meta13.outputs.labels }} labels: ${{ steps.meta13.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
build-tools-ghcr:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- 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: Extract metadata (tags, labels) for Docker openim-web
id: meta1
uses: docker/metadata-action@v4.6.0
with:
images: ghcr.io/openimsdk/openim-web
- name: Build and push Docker image for openim-web
uses: docker/build-push-action@v4
with:
context: .
file: ./build/images/openim-tools/openim-web/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta1.outputs.tags }}
labels: ${{ steps.meta1.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Extract metadata (tags, labels) for Docker openim-web
id: meta2
uses: docker/metadata-action@v4.6.0
with:
images: ghcr.io/openimsdk/component
- name: Build and push Docker image for component
uses: docker/build-push-action@v4
with:
context: .
file: ./build/images/openim-tools/component/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta2.outputs.tags }}
labels: ${{ steps.meta2.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

@ -291,6 +291,24 @@ builds:
- "6" - "6"
- "7" - "7"
- binary: openim-web
id: openim-web
main: ./tools/openim-web/openim-web.go
goos:
- darwin
- windows
- linux
goarch:
- s390x
- mips64
- mips64le
- amd64
- ppc64le
- arm64
goarm:
- "6"
- "7"
- binary: component - binary: component
id: component id: component
main: ./tools/component/component.go main: ./tools/component/component.go

@ -49,4 +49,4 @@ EXPOSE $PORT
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-api /usr/bin/openim-api RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/openim-api /usr/bin/openim-api
CMD ["bash", "-c", "openim-api -c $CONFIG --port $PORT"] ENTRYPOINT ["bash", "-c", "openim-api -c $CONFIG --port $PORT"]

@ -0,0 +1,49 @@
# 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
ARG GOPROXY=https://goproxy.cn,direct
WORKDIR /openim/openim-server
ENV GO111MODULE=$GO111MODULE
ENV GOPROXY=$GOPROXY
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN make clean
RUN make build BINS=component
# FROM ghcr.io/openim-sigs/openim-bash-image:latest
FROM ghcr.io/openim-sigs/openim-bash-image:latest
WORKDIR /openim/openim-server
COPY --from=builder /openim/openim-server/_output/bin/tools /openim/openim-server/_output/bin/tools/
COPY --from=builder /openim/openim-server/config /openim/openim-server/config
ENV CONFIG=/openim/openim-server/config
RUN mv ${OPENIM_SERVER_BINDIR}/platforms/$(get_os)/$(get_arch)/component /usr/bin/component
ENTRYPOINT ["bash", "-c", "component -c $CONFIG"]
Loading…
Cancel
Save