forked from ms/transocks
Добавлен workflow для сборки образа Docker.
Some checks failed
release / release (push) Failing after 51s
Some checks failed
release / release (push) Failing after 51s
This commit is contained in:
parent
283504b292
commit
a3fd0fc110
53
.gitea/workflows/build.yaml
Normal file
53
.gitea/workflows/build.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: check-out
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: set-up qemu
|
||||
uses: https://git.mousesoft.ru/ms/gitea-action-setup-qemu@v3
|
||||
|
||||
- name: set-up docker buildx
|
||||
uses: https://git.mousesoft.ru/ms/gitea-action-docker-setup-buildx@v3
|
||||
with:
|
||||
buildkitd-flags: --debug
|
||||
|
||||
# - name: login to docker hub
|
||||
# uses: https://git.mousesoft.ru/ms/gitea-action-docker-login@v3
|
||||
# with:
|
||||
# registry: git.mousesoft.ru
|
||||
# username: ${{ secrets.API_USER }}
|
||||
# password: ${{ secrets.API_TOKEN }}
|
||||
|
||||
- name: meta
|
||||
id: meta
|
||||
run: |
|
||||
echo IMAGE_CREATED=$(date -u +'%Y-%m-%dT%H:%M:%SZ') | tee -a $GITHUB_OUTPUT
|
||||
echo IMAGE_VERSION=$(./version.sh n) | tee -a $GITHUB_OUTPUT
|
||||
echo IMAGE_REVISION=$(git rev-parse HEAD) | tee -a $GITHUB_OUTPUT
|
||||
|
||||
- name: build and push
|
||||
uses: https://git.mousesoft.ru/ms/gitea-action-docker-build-push@v6
|
||||
with:
|
||||
# context: .
|
||||
# file: Dockerfile
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
pull: true
|
||||
push: true
|
||||
no-cache: true
|
||||
build-args: |
|
||||
IMAGE_VERSION=${{ steps.meta.outputs.IMAGE_VERSION }}
|
||||
IMAGE_CREATED=${{ steps.meta.outputs.IMAGE_CREATED }}
|
||||
tags: |
|
||||
git.mousesoft.ru/ms/transocks:${{ steps.meta.outputs.IMAGE_VERSION }}
|
||||
git.mousesoft.ru/ms/transocks:latest
|
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"cSpell.words": [
|
||||
"transocks"
|
||||
]
|
||||
}
|
32
Dockerfile
Normal file
32
Dockerfile
Normal file
@ -0,0 +1,32 @@
|
||||
# Start by building the application.
|
||||
FROM docker.io/golang:1.22 AS build
|
||||
|
||||
WORKDIR /usr/src/transocks
|
||||
COPY . .
|
||||
|
||||
RUN go build -trimpath -o transocks ./cmd/transocks
|
||||
|
||||
# Now copy it into our base image.
|
||||
FROM gcr.io/distroless/static-debian11:nonroot
|
||||
|
||||
COPY --from=build /usr/src/transocks/transocks /usr/bin/transocks
|
||||
|
||||
VOLUME [ "/etc/transocks" ]
|
||||
ENTRYPOINT [ "/usr/bin/transocks" ]
|
||||
CMD [ "--config", "/etc/wireproxy/config" ]
|
||||
|
||||
ARG IMAGE_CREATED
|
||||
ARG IMAGE_VERSION
|
||||
ARG IMAGE_REVISION
|
||||
|
||||
LABEL org.opencontainers.image.created="${IMAGE_CREATED}" \
|
||||
org.opencontainers.image.authors="MouseSoft" \
|
||||
org.opencontainers.image.url="https://git.mousesoft.ru/ms/transocks" \
|
||||
org.opencontainers.image.documentation="https://git.mousesoft.ru/ms/transocks/src/branch/master/README.md" \
|
||||
org.opencontainers.image.source="https://git.mousesoft.ru/ms/transocks" \
|
||||
org.opencontainers.image.version="${IMAGE_VERSION}" \
|
||||
org.opencontainers.image.revision="${IMAGE_REVISION}" \
|
||||
org.opencontainers.image.vendor="MouseSoft" \
|
||||
org.opencontainers.image.licenses="MIT" \
|
||||
org.opencontainers.image.title="transocks - a transparent SOCKS5/HTTP proxy" \
|
||||
org.opencontainers.image.description="transocks is a background service to redirect TCP connections transparently to a SOCKS5 server or a HTTP proxy server like Squid."
|
6
go.mod
6
go.mod
@ -1,6 +1,6 @@
|
||||
module github.com/cybozu-go/transocks
|
||||
|
||||
go 1.20
|
||||
go 1.22
|
||||
|
||||
require (
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
@ -12,21 +12,17 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.7 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/magiconair/properties v1.8.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.0.0 // indirect
|
||||
github.com/pelletier/go-toml v1.2.0 // indirect
|
||||
github.com/pkg/errors v0.8.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/spf13/afero v1.1.2 // indirect
|
||||
github.com/spf13/cast v1.2.0 // indirect
|
||||
github.com/spf13/jwalterweatherman v1.0.0 // indirect
|
||||
github.com/spf13/pflag v1.0.3 // indirect
|
||||
github.com/spf13/viper v1.2.1 // indirect
|
||||
github.com/stretchr/testify v1.2.2 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 // indirect
|
||||
gopkg.in/yaml.v2 v2.2.1 // indirect
|
||||
)
|
||||
|
23
version.sh
Executable file
23
version.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z ${TAG_NAME+x} ]; then
|
||||
if [ -z ${BRANCH_NAME+x} ]; then
|
||||
BRANCH_NAME=$(echo $(git branch --show-current) || \
|
||||
echo $(git name-rev --name-only HEAD))
|
||||
fi
|
||||
GIT_VERSION=$(echo ${BRANCH_NAME} | grep -q 'release/' \
|
||||
&& echo ${BRANCH_NAME} | sed -e 's|release/|v|' -e 's/$/-RC/' || \
|
||||
echo $(git describe --always --tags --dirty 2>/dev/null) || echo v0)
|
||||
else
|
||||
GIT_VERSION=${TAG_NAME}
|
||||
fi
|
||||
|
||||
if [ -z ${VERSION+x} ]; then
|
||||
VERSION=$(echo ${GIT_VERSION} | sed -e 's|^origin/||')
|
||||
fi
|
||||
|
||||
if [ -z $1 ]; then
|
||||
echo "${VERSION}"
|
||||
else
|
||||
echo ${VERSION} | sed -e 's/^v//'
|
||||
fi
|
Loading…
Reference in New Issue
Block a user