Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shizunge committed Jun 25, 2023
0 parents commit 5638f6b
Show file tree
Hide file tree
Showing 14 changed files with 2,023 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
54 changes: 54 additions & 0 deletions .github/workflows/on-push-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: On push to main

on:
push:
branches:
- main

env:
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"

jobs:
build_and_push:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Extract tag string
id: git
shell: bash
run: |
RELEASE_VERSION="dev-$(date +%s)"
echo "image_tag=${RELEASE_VERSION}" >> ${GITHUB_OUTPUT}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Install buildx
uses: docker/[email protected]

- name: Login to docker hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
uses: docker/[email protected]
with:
platforms: ${{ env.PLATFORMS }}
push: true
tags: |
${{ github.repository }}:${{ steps.git.outputs.image_tag }}
${{ github.repository }}:development
ghcr.io/${{ github.repository }}:${{ steps.git.outputs.image_tag }}
ghcr.io/${{ github.repository }}:development
62 changes: 62 additions & 0 deletions .github/workflows/on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: On release

on:
release:
types: # This configuration does not affect the page_build event above
- created

env:
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"

jobs:
build_and_push:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Extract tag string
id: git
shell: bash
run: |
RELEASE_VERSION=${GITHUB_REF#refs/*/}
echo "image_tag=${RELEASE_VERSION}" >> ${GITHUB_OUTPUT}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Install buildx
uses: docker/[email protected]

- name: Login to docker hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
uses: docker/[email protected]
with:
platforms: ${{ env.PLATFORMS }}
push: true
tags: |
${{ github.repository }}:${{ steps.git.outputs.image_tag }}
${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.git.outputs.image_tag }}
ghcr.io/${{ github.repository }}:latest
- name: Update dockerhub description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ github.repository }}
short-description: ${{ github.event.repository.description }}
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM alpinelinux/docker-cli:latest

LABEL org.opencontainers.image.title=gantry
LABEL org.opencontainers.image.description="Updating docker swarm services"
LABEL org.opencontainers.image.vendor="Shizun Ge"
LABEL org.opencontainers.image.licenses=GPLv3

RUN mkdir -p /gantry

WORKDIR /gantry

RUN apk add --update --no-cache curl tzdata

COPY src/* /gantry

ENTRYPOINT ["/gantry/entrypoint.sh"]
Loading

0 comments on commit 5638f6b

Please sign in to comment.