diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..593f4e69 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +.git +vendor diff --git a/deployments/Dockerfile b/deployments/Dockerfile new file mode 100644 index 00000000..d09b9d9d --- /dev/null +++ b/deployments/Dockerfile @@ -0,0 +1,10 @@ +FROM alpine:latest + +# Set the working directory +WORKDIR /app + +# Copy compiled binary into the container +COPY fresh-proxy-list /app/fresh-proxy-list + +# Set default command to run application +ENTRYPOINT ["/app/fresh-proxy-list"] diff --git a/deployments/goreleaser.yml b/deployments/goreleaser.yml new file mode 100644 index 00000000..80095a50 --- /dev/null +++ b/deployments/goreleaser.yml @@ -0,0 +1,73 @@ +version: 2 +project_name: fresh-proxy-list +env: + - GO111MODULE=on + +builds: + - env: + - CGO_ENABLED=0 + + main: ./cmd/main.go + flags: -trimpath + ldflags: + - -s -w + - -extldflags=-static + mod_timestamp: "{{ .CommitTimestamp }}" + goos: + - linux + - windows + - darwin + goarch: + - arm + - arm64 + - amd64 + +checksum: + name_template: "{{ .ProjectName }}_checksums.txt" + +archives: + - name_template: "{{ .ProjectName }}-{{ .Env.TAG_VERSION }}-{{ .Os }}-{{ .Arch }}" + format_overrides: + - goos: windows + format: zip + files: + - README*.md + - LICENSE + +dockers: + - image_templates: + - "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:{{ .Env.TAG_VERSION }}-amd64" + use: buildx + dockerfile: ./deployments/Dockerfile + build_flag_templates: + - "--platform=linux/amd64" + - image_templates: + - "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:{{ .Env.TAG_VERSION }}-arm64" + - "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:latest" + use: buildx + dockerfile: ./deployments/Dockerfile + goarch: arm64 + build_flag_templates: + - --platform=linux/arm64/v8 + +docker_manifests: + - name_template: "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:{{ .Env.TAG_VERSION }}" + image_templates: + - "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:{{ .Env.TAG_VERSION }}-amd64" + - "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:{{ .Env.TAG_VERSION }}-arm64" + - name_template: "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:latest" + image_templates: + - "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:{{ .Env.TAG_VERSION }}-amd64" + - "ghcr.io/{{ .Env.DOCKER_USERNAME }}/{{ .Env.DOCKER_REPOSITORY }}:{{ .Env.TAG_VERSION }}-arm64" + +changelog: + sort: asc + filters: + exclude: + - "^docs" + - "^test" + - "^ci" + - "^README" + - "^Update" + - Merge pull request + - Merge branch