Skip to content

Commit

Permalink
Merge pull request #9 from coollabsio/next
Browse files Browse the repository at this point in the history
Next
  • Loading branch information
andrasbacsai authored Oct 21, 2024
2 parents a029209 + a302cd3 commit 77cc853
Show file tree
Hide file tree
Showing 30 changed files with 1,632 additions and 1,797 deletions.
51 changes: 51 additions & 0 deletions .air.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"

[build]
args_bin = []
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata", "db", "output"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
include_file = []
kill_delay = "0s"
log = "build-errors.log"
poll = false
poll_interval = 0
post_cmd = []
pre_cmd = []
rerun = false
rerun_delay = 500
send_interrupt = false
stop_on_error = false

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
main_only = false
time = false

[misc]
clean_on_exit = false

[proxy]
app_port = 0
enabled = false
proxy_port = 0

[screen]
clear_on_rebuild = false
keep_scroll = true
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
logs
metrics
tmp
output
db/*
.env
4 changes: 4 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DEBUG=true
TOKEN=
PUSH_ENDPOINT=http://localhost:8000
PUSH_INTERVAL_SECONDS=1
75 changes: 75 additions & 0 deletions .github/workflows/release-next.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Sentinel Release

on:
push:
branches: ['next']

env:
REGISTRY: ghcr.io
IMAGE_NAME: "coollabsio/sentinel"

jobs:
amd64:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next
aarch64:
runs-on: [ self-hosted, arm64 ]
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.arm64
platforms: linux/aarch64
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64
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: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create & publish manifest
run: |
docker buildx imagetools create --append ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next-aarch64 --tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:next
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Sentinel Release
on:
release:
types: [released]

env:
REGISTRY: ghcr.io
IMAGE_NAME: "coollabsio/sentinel"
Expand Down Expand Up @@ -33,6 +33,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
logs
metrics
tmp
output
db/*
.env
22 changes: 15 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
FROM golang:1.22-alpine3.19 AS build
FROM golang:1.23-bullseye AS deps

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 . .
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
RUN go build -o /app/bin/sentinel ./cmd/sentinel
RUN apt-get update && apt-get install -y gcc g++
ENV CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64

RUN go build -o /app/bin/sentinel ./

FROM alpine:3.19
RUN apk add --no-cache 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"]
24 changes: 16 additions & 8 deletions Dockerfile.arm64
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
FROM golang:1.22-alpine3.19 AS build
FROM golang:1.23-bullseye AS deps

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 . .
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=arm64
RUN go build -o /app/bin/sentinel ./cmd/sentinel
RUN apt-get update && apt-get install -y gcc g++
ENV CGO_ENABLED=1 \
GOOS=linux \
GOARCH=arm64

RUN go build -o /app/bin/sentinel ./

FROM alpine:3.19
RUN apk add --no-cache 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"]
CMD ["/app/sentinel"]
Loading

0 comments on commit 77cc853

Please sign in to comment.