forked from seaweedfs/seaweedfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build And Push | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Alicloud Docker registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: jibutech-registry.cn-hangzhou.cr.aliyuncs.com | ||
username: ${{ secrets.JIBUTECH_ALI_REGISTRY_USER }} | ||
password: ${{ secrets.JIBUTECH_ALI_REGISTRY_PASS }} | ||
- name: Build and push Docker images | ||
run: | | ||
GOPROXY=https://proxy.golang.org,direct make container |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
FROM --platform=${BUILDPLATFORM} registry.cn-shanghai.aliyuncs.com/jibutech/golang:1.21.1-bullseye as builder | ||
ARG TARGETARCH | ||
ARG TARGETOS | ||
|
||
WORKDIR /seaweedfs | ||
|
||
ENV CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} | ||
ARG GOPROXY=https://goproxy.cn,direct | ||
ARG LDFLAGS="" | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
# Get dependencies - will also be cached if we won't change mod/sum | ||
RUN --mount=type=cache,target=/go/pkg,id=go-mod-cache,sharing=locked \ | ||
go mod download | ||
|
||
COPY weed weed | ||
|
||
RUN --mount=type=cache,target=/go/pkg,id=go-mod-cache,sharing=locked \ | ||
go build -ldflags "$LDFLAGS" -o /weed ./weed | ||
|
||
RUN --mount=type=cache,target=/go/pkg,id=go-mod-cache,sharing=locked \ | ||
go build -ldflags "$LDFLAGS" -o /weed_pub_kv ./weed/mq/client/cmd/weed_pub_kv | ||
|
||
RUN --mount=type=cache,target=/go/pkg,id=go-mod-cache,sharing=locked \ | ||
go build -ldflags "$LDFLAGS" -o /weed_pub_record ./weed/mq/client/cmd/weed_pub_record | ||
|
||
RUN --mount=type=cache,target=/go/pkg,id=go-mod-cache,sharing=locked \ | ||
go build -ldflags "$LDFLAGS" -o /weed_sub_kv ./weed/mq/client/cmd/weed_sub_kv | ||
|
||
RUN --mount=type=cache,target=/go/pkg,id=go-mod-cache,sharing=locked \ | ||
go build -ldflags "$LDFLAGS" -o /weed_sub_record ./weed/mq/client/cmd/weed_sub_record | ||
|
||
FROM registry.cn-shanghai.aliyuncs.com/jibutech/alpine:3.18.4 AS final | ||
|
||
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && \ | ||
# apk --no-cache add ca-certificates && \ | ||
apk update && \ | ||
apk add --no-cache fuse && \ | ||
apk add --no-cache curl | ||
|
||
# volume server grpc port | ||
EXPOSE 18080 | ||
# volume server http port | ||
EXPOSE 8080 | ||
# filer server grpc port | ||
EXPOSE 18888 | ||
# filer server http port | ||
EXPOSE 8888 | ||
# master server shared grpc port | ||
EXPOSE 19333 | ||
# master server shared http port | ||
EXPOSE 9333 | ||
# s3 server http port | ||
EXPOSE 8333 | ||
# webdav server http port | ||
EXPOSE 7333 | ||
|
||
COPY ./docker/filer_mysql.toml /etc/seaweedfs/filer.toml | ||
COPY ./docker/master-udm.toml /etc/seaweedfs/master.toml | ||
COPY ./docker/entrypoint.sh /entrypoint.sh | ||
|
||
COPY --from=builder /weed /usr/bin/ | ||
COPY --from=builder /weed_pub* /usr/bin/ | ||
COPY --from=builder /weed_sub* /usr/bin/ | ||
|
||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
OUTPUT=--quiet | ||
if [ "${1:-}" = '--show-diff' ]; then | ||
OUTPUT= | ||
fi | ||
|
||
# If a tagged version, just print that tag | ||
HEAD_TAG=$(git tag --points-at HEAD | head -n1) | ||
if [ -n "${HEAD_TAG}" ] ; then | ||
# remove `v` prefix from release name | ||
if echo "${HEAD_TAG}" | grep -Eq "^v[0-9]+(\.[0-9]+)*(-[a-z0-9]+)?$"; then | ||
HEAD_TAG=$(echo "$HEAD_TAG" | cut -c 2-) | ||
fi | ||
echo "${HEAD_TAG}" | ||
exit 0 | ||
fi | ||
|
||
WORKING_SUFFIX=$(if ! git diff --exit-code "${OUTPUT}" HEAD >&2; \ | ||
then echo "-wip"; \ | ||
else echo ""; \ | ||
fi) | ||
BRANCH_PREFIX=$(git rev-parse --abbrev-ref HEAD) | ||
|
||
# replace spaces with dash | ||
BRANCH_PREFIX=${BRANCH_PREFIX// /-} | ||
# next, replace slashes with dash | ||
BRANCH_PREFIX=${BRANCH_PREFIX//[\/\\]/-} | ||
# now, clean out anything that's not alphanumeric or an dash or '.' | ||
BRANCH_PREFIX=${BRANCH_PREFIX//[^a-zA-Z0-9-.]/} | ||
# finally, lowercase with TR | ||
BRANCH_PREFIX=`echo -n "$BRANCH_PREFIX" | tr A-Z a-z` | ||
DATE=$(date +'%Y%m%d%H%M%S') | ||
|
||
echo "$BRANCH_PREFIX-$(git rev-parse --short HEAD)-${DATE}$WORKING_SUFFIX" |