-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: 2 | ||
updates: | ||
|
||
# Maintain dependencies for GitHub Actions | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
assignees: | ||
- "xZero707" | ||
|
||
# Maintain Docker image dependencies | ||
- package-ecosystem: "docker" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
assignees: | ||
- "xZero707" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build docker image | ||
|
||
on: | ||
push: | ||
branches: master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: checkout code | ||
uses: actions/checkout@v4 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{github.actor}} | ||
password: ${{secrets.PAT_TOKEN}} | ||
- | ||
name: Build and push | ||
uses: docker/[email protected] | ||
with: | ||
files: build/docker-bake.hcl | ||
push: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,7 +33,12 @@ WORKDIR /app | |
|
||
CMD [ "/app/tg-events-service" ] | ||
|
||
|
||
LABEL maintainer="Aleksandar Puharic <[email protected]>" \ | ||
org.opencontainers.image.documentation="https://github.com/xZero707/telegram-event-server/wiki" \ | ||
org.opencontainers.image.source="https://github.com/xZero707/telegram-event-server" \ | ||
org.opencontainers.image.description="Telegram Event Server 1.0.0 - Build ${TARGETPLATFORM}" \ | ||
org.opencontainers.image.licenses="MIT" \ | ||
org.opencontainers.image.version="1.0.0" | ||
|
||
ENV ALLOWED_ORIGINS="http://127.0.0.1" | ||
EXPOSE 8080/TCP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
group "default" { | ||
targets = [ | ||
"1_0_0", | ||
] | ||
} | ||
|
||
target "build-dockerfile" { | ||
dockerfile = "Dockerfile" | ||
} | ||
|
||
target "build-platforms" { | ||
platforms = ["linux/amd64", "linux/aarch64"] | ||
} | ||
|
||
target "build-common" { | ||
pull = true | ||
} | ||
|
||
variable "REGISTRY_CACHE" { | ||
default = "ghcr.io/xZero707/telegram-event-server-cache" | ||
} | ||
|
||
###################### | ||
# Define the functions | ||
###################### | ||
|
||
# Get the arguments for the build | ||
function "get-args" { | ||
params = [version, patch_version] | ||
result = { | ||
WP_VERSION = version | ||
WP_PATCH_VERSION = patch_version | ||
} | ||
} | ||
|
||
# Get the cache-from configuration | ||
function "get-cache-from" { | ||
params = [version] | ||
result = [ | ||
"type=registry,ref=${REGISTRY_CACHE}:${sha1("${version}-${BAKE_LOCAL_PLATFORM}")}" | ||
] | ||
} | ||
|
||
# Get the cache-to configuration | ||
function "get-cache-to" { | ||
params = [version] | ||
result = [ | ||
"type=registry,mode=max,ref=${REGISTRY_CACHE}:${sha1("${version}-${BAKE_LOCAL_PLATFORM}")}" | ||
] | ||
} | ||
|
||
# Get list of image tags and registries | ||
# Takes a version and a list of extra versions to tag | ||
# eg. get-tags("1.0.0", ["1", "1.0", "latest"]) | ||
function "get-tags" { | ||
params = [version, extra_versions] | ||
result = concat( | ||
[ | ||
"ghcr.io/xZero707/telegram-event-server:${version}" | ||
], | ||
flatten([ | ||
for extra_version in extra_versions : [ | ||
"ghcr.io/xZero707/telegram-event-server:${extra_version}" | ||
] | ||
]) | ||
) | ||
} | ||
|
||
########################## | ||
# Define the build targets | ||
########################## | ||
|
||
target "1_0_0" { | ||
inherits = ["build-dockerfile", "build-platforms", "build-common"] | ||
cache-from = get-cache-from("1.0.0") | ||
cache-to = get-cache-to("1.0.0") | ||
tags = get-tags("1.0.0", ["1", "1.0", "latest"]) | ||
args = get-args("1.0.0", "1.0.0") | ||
} |