Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lots of updates #15

Merged
merged 22 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
0be3889
fix: http client requests
andrasbacsai Oct 22, 2024
0e497fc
enhance: add context directly where we start the docker http client
LaurenceJJones Oct 22, 2024
20c4803
Merge pull request #12 from LaurenceJJones/dockerdial
andrasbacsai Oct 22, 2024
4bed0fa
Refactor push.go to include filesystem usage data
andrasbacsai Oct 22, 2024
a60b2e8
Refactor push.go to remove debug print statement
andrasbacsai Oct 22, 2024
bdf0ff8
Refactor release-next.yaml to include multiple registries and labels
andrasbacsai Oct 22, 2024
3f349fb
Refactor release-next.yaml to use Dockerfile.arm64 for linux/aarch64 …
andrasbacsai Oct 22, 2024
2e4530c
Refactor Dockerfile to use cache for go modules and package installation
andrasbacsai Oct 22, 2024
2615e20
Refactor Dockerfile to use cache for go modules and package installation
andrasbacsai Oct 22, 2024
0c7785e
enhance: Code qol and improve debug
LaurenceJJones Oct 22, 2024
6b4376e
enhance: Major refactoring of repo
LaurenceJJones Oct 27, 2024
a3cb138
enhance: rename pusher folder to push, update links
LaurenceJJones Oct 27, 2024
b618e06
Merge pull request #13 from LaurenceJJones/simple_qol
andrasbacsai Oct 29, 2024
fd89530
Refactor debug routes in controller package
andrasbacsai Oct 29, 2024
882d3eb
Refactor debug routes in controller package and improve debug configu…
andrasbacsai Oct 29, 2024
b09cf1f
Merge pull request #14 from coollabsio/simple_qol
andrasbacsai Oct 29, 2024
5125d23
Refactor Docker image build and publish workflow
andrasbacsai Oct 29, 2024
7844d68
Refactor Docker image build and publish workflow
andrasbacsai Oct 29, 2024
a1ec5c0
Refactor Docker image build and publish workflow for ARM64 architecture
andrasbacsai Oct 29, 2024
278eab8
Refactor debug routes in controller package and improve debug configu…
andrasbacsai Oct 29, 2024
569dd99
fix endpoint
andrasbacsai Oct 29, 2024
9cd273c
fix: prod release workflow
andrasbacsai Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 69 additions & 22 deletions .github/workflows/release-next.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Sentinel Release
name: Sentinel Release Development

on:
push:
branches: ['next']

env:
REGISTRY: ghcr.io
GITHUB_REGISTRY: ghcr.io
DOCKER_REGISTRY: docker.io
IMAGE_NAME: "coollabsio/sentinel"

jobs:
Expand All @@ -16,60 +17,106 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to ghcr.io

- name: Login to ${{ env.GITHUB_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5

- name: Login to ${{ env.DOCKER_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and Push Image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next
tags: |
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:next-amd64
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:next-amd64
labels: |
coolify.managed=true
aarch64:
runs-on: [ self-hosted, arm64 ]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to ghcr.io

- name: Login to ${{ env.GITHUB_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5

- name: Login to ${{ env.DOCKER_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and Push Image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.arm64
platforms: linux/aarch64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64
tags: |
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64
labels: |
coolify.managed=true
merge-manifest:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [ amd64, aarch64 ]
steps:
- name: Checkout
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 ghcr.io
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3

- name: Login to ${{ env.GITHUB_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create & publish manifest

- name: Login to ${{ env.DOCKER_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Create & publish manifest on ${{ env.DOCKER_REGISTRY }}
run: |
docker buildx imagetools create \
--append ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 \
--tag ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:next-amd64 \
--tag ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:next

- name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }}
run: |
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next
docker buildx imagetools create \
--append ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 \
--tag ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:next-amd64 \
--tag ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:next

- uses: sarisia/actions-status-discord@v1
if: always()
with:
webhook: ${{ secrets.DISCORD_WEBHOOK_DEV_RELEASE_CHANNEL }}
102 changes: 61 additions & 41 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Sentinel Release
name: Sentinel Release Development

on:
release:
types: [released]

env:
REGISTRY: ghcr.io
GITHUB_REGISTRY: ghcr.io
DOCKER_REGISTRY: docker.io
IMAGE_NAME: "coollabsio/sentinel"

jobs:
Expand All @@ -16,82 +17,101 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to ghcr.io

- name: Login to ${{ env.GITHUB_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5

- name: Login to ${{ env.DOCKER_REGISTRY }}
uses: docker/login-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
- name: Build and push
uses: docker/build-push-action@v5
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and Push Image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
tags: |
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-amd64
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-amd64
labels: |
coolify.managed=true
aarch64:
runs-on: [ self-hosted, arm64 ]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to ghcr.io

- name: Login to ${{ env.GITHUB_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5

- name: Login to ${{ env.DOCKER_REGISTRY }}
uses: docker/login-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}-aarch64
- name: Build and push
uses: docker/build-push-action@v5
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and Push Image
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile.arm64
platforms: linux/aarch64
push: true
tags: ${{ steps.meta.outputs.tags }}-aarch64
tags: |
${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-aarch64
${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-aarch64
labels: |
coolify.managed=true
merge-manifest:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs: [ amd64, aarch64 ]
steps:
- name: Checkout
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 ghcr.io
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3

- name: Login to ${{ env.GITHUB_REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
registry: ${{ env.GITHUB_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels)
id: meta
uses: docker/metadata-action@v5

- name: Login to ${{ env.DOCKER_REGISTRY }}
uses: docker/login-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
- name: Create & publish manifest
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Create & publish manifest on ${{ env.DOCKER_REGISTRY }}
run: |
docker buildx imagetools create \
--append ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-aarch64 \
--tag ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-amd64 \
--tag ${{ env.DOCKER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}

- name: Create & publish manifest on ${{ env.GITHUB_REGISTRY }}
run: |
docker buildx imagetools create --append ${{ fromJSON(steps.meta.outputs.json).tags[0] }}-aarch64 --tag ${{ fromJSON(steps.meta.outputs.json).tags[0] }}
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
docker buildx imagetools create \
--append ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-aarch64 \
--tag ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}-amd64 \
--tag ${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.release.tag_name }}
24 changes: 10 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
FROM golang:1.23-bullseye AS deps
FROM golang:1.23-alpine AS builder

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download

FROM golang:1.23-bullseye AS build

WORKDIR /app
COPY --from=deps /go/pkg/mod /go/pkg/mod
COPY . .
RUN apt-get update && apt-get install -y gcc g++
ENV CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64
RUN --mount=type=cache,target=/var/cache/apk \
apk update && \
apk add gcc g++ && \
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /app/sentinel ./

RUN go build -o /app/bin/sentinel ./
FROM alpine:latest
RUN --mount=type=cache,target=/var/cache/apk \
apk update && \
apk add ca-certificates curl

FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
ENV GIN_MODE=release
COPY --from=build /app/ /app
COPY --from=build /app/bin/sentinel /app/sentinel
COPY --from=builder /app/sentinel /app/sentinel
CMD ["/app/sentinel"]
26 changes: 11 additions & 15 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
FROM golang:1.23-bullseye AS deps
FROM golang:1.23-alpine AS builder

WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download

FROM golang:1.23-bullseye AS build

WORKDIR /app
COPY --from=deps /go/pkg/mod /go/pkg/mod
COPY . .
RUN apt-get update && apt-get install -y gcc g++
ENV CGO_ENABLED=1 \
GOOS=linux \
GOARCH=arm64
RUN --mount=type=cache,target=/var/cache/apk \
apk update && \
apk add gcc g++ && \
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -o /app/sentinel ./

RUN go build -o /app/bin/sentinel ./
FROM alpine:latest
RUN --mount=type=cache,target=/var/cache/apk \
apk update && \
apk add ca-certificates curl

FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y ca-certificates curl && rm -rf /var/lib/apt/lists/*
ENV GIN_MODE=release
COPY --from=build /app/ /app
COPY --from=build /app/bin/sentinel /app/sentinel
CMD ["/app/sentinel"]
COPY --from=builder /app/sentinel /app/sentinel
CMD ["/app/sentinel"]
Loading