diff --git a/.github/workflows/push-to-docker.yml b/.github/workflows/push-to-docker.yml index 27dc502..65b3496 100644 --- a/.github/workflows/push-to-docker.yml +++ b/.github/workflows/push-to-docker.yml @@ -56,7 +56,7 @@ jobs: with: distribution: goreleaser version: latest - args: build --rm-dist ${{ steps.snapshot.outputs.ARG }} + args: build --rm-dist --id docker ${{ steps.snapshot.outputs.ARG }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - @@ -84,3 +84,6 @@ jobs: push: ${{ github.event_name != 'pull_request' }} platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + shm-size: 2g diff --git a/.goreleaser.yml b/.goreleaser.yml index 6a8ab1e..f6d578d 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -47,6 +47,20 @@ builds: - -trimpath ldflags: - -s -w -X main.VERSION=v{{.Version}} + - id: docker + env: + - CGO_ENABLED=0 + - GO111MODULE=on + goos: + - linux + goarch: + - amd64 + - arm64 + mod_timestamp: "{{ .CommitTimestamp }}" + flags: + - -trimpath + ldflags: + - -s -w -X main.VERSION=v{{.Version}} checksum: name_template: "{{ .ProjectName }}_checksums.txt" @@ -86,4 +100,7 @@ nfpms: formats: - deb - rpm - maintainer: johlanse \ No newline at end of file + maintainer: johlanse + builds: + - nowin + - win \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index b36aa5c..dac0132 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,18 +2,22 @@ FROM debian:bullseye-slim ARG TARGETARCH -COPY ./dist/nowin_linux_$TARGETARCH*/study_xxqg /opt/study_xxqg +RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ + echo 'Asia/Shanghai' >/etc/timezone && \ + apt-get -qq update && \ + apt-get -qq install -y --no-install-recommends ca-certificates curl && \ + apt-get install -y libx11-6 libgbm1 libasound2 libcairo2 libxshmfence1 libatspi2.0-0 libpango-1.0-0 libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libxrandr2 libxfixes3 libxdamage1 libxcomposite1 libxkbcommon0 && \ + apt-get clean && \ + mkdir /opt/config/ -RUN mkdir /opt/config/ +COPY ./dist/docker_linux_$TARGETARCH*/study_xxqg /opt/study_xxqg COPY conf/config_default.yml /opt/config/config.yml -RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \ - echo 'Asia/Shanghai' >/etc/timezone && apt-get -qq update \ - && apt-get -qq install -y --no-install-recommends ca-certificates curl \ - && apt-get update && apt-get install -y libx11-6 libgbm1 libasound2 libcairo2 libxshmfence1 libatspi2.0-0 libpango-1.0-0 libnss3 \ - libatk1.0-0 libatk-bridge2.0-0 libcups2 libxrandr2 libxfixes3 libxdamage1 libxcomposite1 libxkbcommon0 \ - && chmod -R 777 /opt/study_xxqg && cd /opt/ && ./study_xxqg --init +RUN chmod -R 777 /opt/study_xxqg && \ + cd /opt/ && \ + ./study_xxqg --init + EXPOSE 8080 VOLUME /opt/config