Skip to content

Instantly share code, notes, and snippets.

@irgeek
Last active May 15, 2024 10:50
Show Gist options
  • Save irgeek/e56d0509a0b77129fdda0faae9fe4b1f to your computer and use it in GitHub Desktop.
Save irgeek/e56d0509a0b77129fdda0faae9fe4b1f to your computer and use it in GitHub Desktop.
Brimstone support files.
#!/bin/bash
set -x
TARGET="${1}"
BINDIR="${2:-build}"
if [[ ! -d "${BINDIR}" ]]; then
mkdir -p "${BINDIR}"
fi
go build \
-o "${BINDIR}/${TARGET}" \
-ldflags "-X main.version=$(<VERSION)" \
"cmd/${TARGET}/main.go"
ls -l "${BINDIR}/${TARGET}"
name: brimstone-demo
services:
brimstone:
build: .
env_file:
- .env
environment:
- DB_URL=postgres:///${POSTGRESQL_DATABASE}?host=${POSTGRESQL_HOST:-/tmp}&user=${POSTGRESQL_USERNAME}&password=${POSTGRESQL_PASSWORD}&sslmode=${POSTGRES_SSLMODE:-require}&timezone=${POSTGRES_TIMEZONE:-utc}
command: /usr/local/bin/brimstone
restart: always
volumes:
- type: volume
source: tmp_data
target: /tmp
ports:
- 9191:9191
depends_on:
postgres:
condition: service_healthy
postgres:
image: docker.io/bitnami/postgresql:16.2.0-debian-12-r10
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 10s
timeout: 5s
retries: 5
env_file:
- .env
restart: always
volumes:
- type: volume
source: tmp_data
target: /tmp
- type: volume
source: db_data
target: /var/lib/postgresql/data
- type: tmpfs
target: /dev/shm
tmpfs:
size: 268435456
volumes:
tmp_data:
db_data:
FROM golang:alpine as build
RUN apk add --no-cache \
ca-certificates \
bash
ENV BINDIR=/usr/local/bin
WORKDIR /build
COPY VERSION go.mod go.sum ./
COPY cmd ./cmd
COPY pkg ./pkg
RUN go mod download
COPY build.sh ./
RUN ./build.sh brimstone "${BINDIR}"
RUN ./build.sh hailstone "${BINDIR}"
FROM alpine:latest
RUN apk add --no-cache \
ca-certificates \
curl \
bash
COPY --from=build /usr/local/bin /usr/local/bin
WORKDIR /root
GG_API_TOKEN=
GG_WEBHOOK_TOKEN=
ID_TENANT_URL=
PCLOUD_URL=
SAFE_NAME=
PLATFORM_ID=UnixSSH
PAM_USER=
PAM_PASS=
BRIMSTONE_API_KEY=
BRIMSTONE_URL=http://localhost:9191
POSTGRESQL_DATABASE=brimstone
POSTGRESQL_USERNAME=brimstone
POSTGRESQL_PASSWORD=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment