Compare commits
3 Commits
v1.0.6
...
14c251f3e4
| Author | SHA1 | Date | |
|---|---|---|---|
|
14c251f3e4
|
|||
|
317ebfdf5f
|
|||
|
68bb6199b9
|
@@ -1,28 +0,0 @@
|
|||||||
name: release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
name: Checkout
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup go
|
|
||||||
uses: https://github.com/actions/setup-go@v4
|
|
||||||
with:
|
|
||||||
go-version: '>=1.23.6'
|
|
||||||
- name: Compile
|
|
||||||
run: make release
|
|
||||||
- name: Make release
|
|
||||||
id: use-go-action
|
|
||||||
uses: https://gitea.com/actions/release-action@main
|
|
||||||
with:
|
|
||||||
files: |-
|
|
||||||
bin/*.zip
|
|
||||||
api_key: '${{secrets.RELEASE_TOKEN}}'
|
|
||||||
65
.gitea/workflows/release.yml
Normal file
65
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# https://docs.gitea.com/usage/actions/overview
|
||||||
|
# https://docs.github.com/ru/actions/reference/workflows-and-actions/contexts
|
||||||
|
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with: # https://github.com/actions/checkout
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set up go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with: # https://github.com/actions/setup-go
|
||||||
|
go-version: '>=1.24.2'
|
||||||
|
|
||||||
|
- name: Build release files (amd64)
|
||||||
|
run: make release ARCH=amd64
|
||||||
|
|
||||||
|
- name: Build release files (arm64)
|
||||||
|
run: make release ARCH=arm64
|
||||||
|
|
||||||
|
- name: Create new release
|
||||||
|
id: use-go-action
|
||||||
|
uses: https://gitea.com/actions/gitea-release-action@main
|
||||||
|
with: # https://gitea.com/actions/gitea-release-action
|
||||||
|
server_url: https://git.axenov.dev
|
||||||
|
token: '${{secrets.RELEASE_TOKEN}}'
|
||||||
|
files: |-
|
||||||
|
bin/*.zip
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with: # https://github.com/docker/setup-buildx-action
|
||||||
|
build-args: "IPTVC_VERSION=${{ github.ref_name }}"
|
||||||
|
buildkitd-config-inline: |
|
||||||
|
# https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md
|
||||||
|
[ registry."docker.io" ]
|
||||||
|
mirrors = ["https://dockerhub.timeweb.cloud", "https://dh-mirror.gitverse.ru"]
|
||||||
|
http = true
|
||||||
|
insecure = true
|
||||||
|
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with: # https://github.com/docker/login-action
|
||||||
|
registry: git.axenov.dev
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
password: ${{ secrets.RELEASE_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push Docker images
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with: # https://github.com/docker/build-push-action
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
git.axenov.dev/iptv/iptvc:${{ github.ref_name }}
|
||||||
|
git.axenov.dev/iptv/iptvc:latest
|
||||||
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
FROM golang:1.25-alpine AS iptv-img-builder
|
||||||
|
ARG GOOS
|
||||||
|
ARG GOARCH
|
||||||
|
ARG IPTVC_VERSION
|
||||||
|
ENV CGO_ENABLED=0
|
||||||
|
ENV GOOS=${GOOS:-linux}
|
||||||
|
ENV GOARCH=${GOARCH:-amd64}
|
||||||
|
COPY go.mod go.sum ./
|
||||||
|
RUN go mod download
|
||||||
|
COPY . .
|
||||||
|
RUN go build \
|
||||||
|
-trimpath \
|
||||||
|
-ldflags="-s -w -X main.version=${IPTVC_VERSION}" \
|
||||||
|
-o /app/iptvc \
|
||||||
|
.
|
||||||
|
|
||||||
|
FROM alpine:3.22.2 AS iptv-img-checker
|
||||||
|
LABEL org.opencontainers.image.authors="Anthony Axenov <anthonyaxenov@gmail.com>"
|
||||||
|
WORKDIR /app
|
||||||
|
RUN apk add --no-cache ca-certificates tzdata
|
||||||
|
RUN addgroup -S iptvc-user && adduser -S -G iptvc-user -H -s /sbin/nologin iptvc-user
|
||||||
|
COPY --from=iptv-img-builder --chown=iptvc-user:iptvc-user /app/iptvc /app/iptvc
|
||||||
|
USER iptvc-user
|
||||||
|
ENTRYPOINT ["/app/iptvc"]
|
||||||
46
Makefile
46
Makefile
@@ -1,46 +1,46 @@
|
|||||||
.DEFAULT_GOAL=help
|
.DEFAULT_GOAL=help
|
||||||
|
|
||||||
BINARY_NAME=iptvc
|
BINARY_NAME := iptvc
|
||||||
ARCH=amd64
|
ARCH ?= amd64
|
||||||
|
|
||||||
LINUX_PATH="bin/linux_${ARCH}"
|
LINUX_PATH := "bin/linux_$(ARCH)"
|
||||||
WINDOWS_PATH="bin/windows_${ARCH}"
|
WINDOWS_PATH := "bin/windows_$(ARCH)"
|
||||||
DARWIN_PATH="bin/darwin_${ARCH}"
|
DARWIN_PATH := "bin/darwin_$(ARCH)"
|
||||||
|
|
||||||
LINUX_FILE="${LINUX_PATH}/${BINARY_NAME}"
|
LINUX_FILE := "$(LINUX_PATH)/$(BINARY_NAME)"
|
||||||
WINDOWS_FILE="${WINDOWS_PATH}/${BINARY_NAME}.exe"
|
WINDOWS_FILE := "$(WINDOWS_PATH)/$(BINARY_NAME).exe"
|
||||||
DARWIN_FILE="${DARWIN_PATH}/${BINARY_NAME}"
|
DARWIN_FILE := "$(DARWIN_PATH)/$(BINARY_NAME)"
|
||||||
|
|
||||||
## clean: Remove all compiled binaries
|
## clean: Remove all compiled binaries
|
||||||
clean:
|
clean:
|
||||||
@go clean
|
@go clean
|
||||||
@rm -rf bin/
|
@rm -rf bin/
|
||||||
|
|
||||||
## linux: Build new binaries for linux (x64)
|
## linux: Build new binaries for linux
|
||||||
linux:
|
linux:
|
||||||
@rm -rf ${LINUX_PATH}
|
@rm -rf $(LINUX_PATH)
|
||||||
@GOARCH=${ARCH} GOOS=linux go build -o ${LINUX_FILE} . && echo "Compiled: ${LINUX_FILE}"
|
@GOARCH=$(ARCH) GOOS=linux go build -o $(LINUX_FILE) . && echo "Compiled: $(LINUX_FILE)"
|
||||||
|
|
||||||
## win: Build new binaries for windows (x64)
|
## win: Build new binaries for windows
|
||||||
win:
|
win:
|
||||||
@rm -rf ${WINDOWS_PATH}
|
@rm -rf $(WINDOWS_PATH)
|
||||||
@GOARCH=${ARCH} GOOS=windows go build -o ${WINDOWS_FILE} . && echo "Compiled: ${WINDOWS_FILE}"
|
@GOARCH=$(ARCH) GOOS=windows go build -o $(WINDOWS_FILE) . && echo "Compiled: $(WINDOWS_FILE)"
|
||||||
|
|
||||||
## darwin: Build new binaries for darwin (x64)
|
## darwin: Build new binaries for darwin
|
||||||
darwin:
|
darwin:
|
||||||
@rm -rf ${DARWIN_PATH}
|
@rm -rf $(DARWIN_PATH)
|
||||||
@GOARCH=${ARCH} GOOS=darwin go build -o ${DARWIN_FILE} . && echo "Compiled: ${DARWIN_FILE}"
|
@GOARCH=$(ARCH) GOOS=darwin go build -o $(DARWIN_FILE) . && echo "Compiled: $(DARWIN_FILE)"
|
||||||
|
|
||||||
## all: Build new binaries for linux, windows and darwin (x64)
|
## all: Build new binaries for linux, windows and darwin
|
||||||
all: clean linux win darwin
|
all: clean linux win darwin
|
||||||
|
|
||||||
## release: Build all binaries and zip them
|
## release: Build all binaries and zip them
|
||||||
release: clean darwin linux win
|
release: linux win darwin
|
||||||
@zip -j ${LINUX_PATH}.zip ${LINUX_FILE}
|
@zip -j $(LINUX_PATH).zip $(LINUX_FILE)
|
||||||
@zip -j ${DARWIN_PATH}.zip ${DARWIN_FILE}
|
@zip -j $(DARWIN_PATH).zip $(DARWIN_FILE)
|
||||||
@zip -j ${WINDOWS_PATH}.zip ${WINDOWS_FILE}
|
@zip -j $(WINDOWS_PATH).zip $(WINDOWS_FILE)
|
||||||
|
|
||||||
## help: Show this message and exit
|
## help: Show this message and exit
|
||||||
help: Makefile
|
help: Makefile
|
||||||
@echo "Choose a command run:"
|
@echo "Available recipes:"
|
||||||
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
|
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
|
||||||
|
|||||||
15
build-docker-image.sh
Executable file
15
build-docker-image.sh
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
[[ "$1" ]] && DOCKER_TAG="$1" || DOCKER_TAG="latest"
|
||||||
|
[[ "$1" ]] && GIT_TAG="$1" || GIT_TAG=$(git describe --tags --always)
|
||||||
|
GIT_HASH=$(git rev-parse --short HEAD)
|
||||||
|
IPTVC_VERSION="${GIT_TAG}-${GIT_HASH}"
|
||||||
|
|
||||||
|
git checkout "${GIT_TAG}" 2>/dev/null
|
||||||
|
docker build \
|
||||||
|
--build-arg IPTVC_VERSION="${IPTVC_VERSION}" \
|
||||||
|
--tag iptvc:"${DOCKER_TAG}" \
|
||||||
|
--tag git.axenov.dev/iptv/iptvc:"${DOCKER_TAG}" \
|
||||||
|
.
|
||||||
|
|
||||||
|
docker push git.axenov.dev/iptv/iptvc:"${DOCKER_TAG}"
|
||||||
Reference in New Issue
Block a user