Skip to content

Commit

Permalink
docker镜像适配zimaOS
Browse files Browse the repository at this point in the history
  • Loading branch information
matteriot committed Mar 1, 2025
1 parent 5af2241 commit 18c34f8
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 22 deletions.
65 changes: 54 additions & 11 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,62 @@ snapcrafts:
command: gateway-go
dockers:
- image_templates:
- 'openiothub/gateway-go:{{ .Tag }}'
- 'openiothub/gateway-go:v{{ .Major }}.{{ .Minor }}'
- 'openiothub/gateway-go:latest'
dockerfile: Dockerfile
ids: ['gateway-go']
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-amd64"
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-amd64"
use: buildx
build_flag_templates:
- "--pull"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source={{.GitURL}}"
- "--label=com.github.actions.name={{.ProjectName}}"

extra_files:
- scripts/entrypoint.sh
- image_templates:
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-arm64"
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-arm64"
use: buildx
build_flag_templates:
- "--platform=linux/arm64"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
goarch: arm64

- image_templates:
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-armv7"
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-armv7"
use: buildx
build_flag_templates:
- "--platform=linux/arm/v7"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.title={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
goarch: arm
goarm: 7

docker_manifests:
- name_template: "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}"
image_templates:
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-amd64"
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-arm64"
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-armv7"

- name_template: "{{ .Env.DOCKER_USERNAME }}/gateway-go:latest"
image_templates:
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-amd64"
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-arm64"
- "{{ .Env.DOCKER_USERNAME }}/gateway-go:{{ .Tag }}-armv7"

- name_template: "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}"
image_templates:
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-amd64"
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-arm64"
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-armv7"

- name_template: "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:latest"
image_templates:
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-amd64"
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-arm64"
- "ghcr.io/{{ tolower .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-armv7"
20 changes: 9 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
FROM alpine:latest
FROM alpine
LABEL name=gateway-go
LABEL url=https://github.com/OpenIoTHub/OpenIoTHub
RUN apk add --no-cache bash

WORKDIR /app
COPY gateway-go /app/
ENV TZ=Asia/Shanghai
#默认的http api端口
EXPOSE 1082
#mdns端口
EXPOSE 5353/udp
EXPOSE 34323/tcp

RUN apk add --no-cache bash

ENTRYPOINT ["/entrypoint.sh"]
CMD [ "-h" ]

COPY scripts/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

COPY gateway-go /bin/gateway-go
ENTRYPOINT ["/app/gateway-go"]
CMD ["-c", "/app/config.yaml"]

0 comments on commit 18c34f8

Please sign in to comment.