mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2024-11-21 22:06:47 +01:00
fix: enable CGO builds
* debian with CGO build step * goreleaser binary build
This commit is contained in:
parent
fa0fbd8b85
commit
529f9ab626
3
.env.example
Normal file
3
.env.example
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
POSTGRES_DSN=postgres://postgres:postgres@postgres:5432/cic_custodial
|
||||||
|
REDIS_DSN=redis://redis:6379/1
|
||||||
|
ASYNQ_DSN=redis://redis:6379/0
|
@ -1,4 +1,4 @@
|
|||||||
name: goreleaser
|
name: binary_release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@ -8,6 +8,8 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
goreleaser:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: goreleaser/goreleaser-cross
|
||||||
environment: build
|
environment: build
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@ -30,6 +32,6 @@ jobs:
|
|||||||
uses: goreleaser/goreleaser-action@v2
|
uses: goreleaser/goreleaser-action@v2
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: --parallelism 1 --rm-dist --skip-validate
|
args: release --rm-dist
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
29
.github/workflows/docker_release.yaml
vendored
Normal file
29
.github/workflows/docker_release.yaml
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: docker_release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: docker/login-action@v1.14.1
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.repository_owner }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: docker compose build push
|
||||||
|
env:
|
||||||
|
DOCKER_BUILDKIT: 1
|
||||||
|
COMPOSE_DOCKER_CLI_BUILD: 1
|
||||||
|
run: |
|
||||||
|
export TAG=$GITHUB_REF_NAME
|
||||||
|
docker-compose -f docker-compose.build.yaml build --progress plain
|
||||||
|
docker-compose -f docker-compose.build.yaml push
|
||||||
|
export TAG=latest
|
||||||
|
docker-compose -f docker-compose.build.yaml build --progress plain
|
||||||
|
docker-compose -f docker-compose.build.yaml push
|
@ -1,6 +1,9 @@
|
|||||||
builds:
|
builds:
|
||||||
|
- id: linux-amd64
|
||||||
- env:
|
- env:
|
||||||
- CGO_ENABLED=1
|
- CGO_ENABLED=1
|
||||||
|
- CC=x86_64-linux-gnu-gcc
|
||||||
|
- CXX=x86_64-linux-gnu-g++
|
||||||
goos:
|
goos:
|
||||||
- linux
|
- linux
|
||||||
goarch:
|
goarch:
|
||||||
@ -8,22 +11,10 @@ builds:
|
|||||||
main: ./cmd
|
main: ./cmd
|
||||||
ldflags:
|
ldflags:
|
||||||
- -s -w
|
- -s -w
|
||||||
|
binary: cic-custodial
|
||||||
|
|
||||||
archives:
|
archives:
|
||||||
- format: tar.gz
|
- format: tar.gz
|
||||||
files:
|
files:
|
||||||
- LICENSE
|
- LICENSE
|
||||||
- config.toml
|
- config.toml
|
||||||
|
|
||||||
dockers:
|
|
||||||
- goos: linux
|
|
||||||
goarch: amd64
|
|
||||||
ids:
|
|
||||||
- cic-custodial
|
|
||||||
image_templates:
|
|
||||||
- "ghcr.io/grassrootseconomics/cic-custodial/cic-custodial:latest"
|
|
||||||
- "ghcr.io/grassrootseconomics/cic-custodial/cic-custodial:{{ .Tag }}"
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
extra_files:
|
|
||||||
- config.toml
|
|
||||||
|
|
10
Dockerfile
10
Dockerfile
@ -1,4 +1,10 @@
|
|||||||
FROM debian:11-slim
|
FROM golang:1.19-bullseye as build
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
COPY . .
|
||||||
|
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o cic-custodial -ldflags="-s -w" cmd/*.go
|
||||||
|
|
||||||
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
RUN set -x && \
|
RUN set -x && \
|
||||||
@ -8,7 +14,7 @@ RUN set -x && \
|
|||||||
|
|
||||||
WORKDIR /service
|
WORKDIR /service
|
||||||
|
|
||||||
COPY cic-custodial .
|
COPY --from=build /build/cic-custodial .
|
||||||
COPY config.toml .
|
COPY config.toml .
|
||||||
|
|
||||||
CMD ["./cic-custodial"]
|
CMD ["./cic-custodial"]
|
||||||
|
10
docker-compose.build.yaml
Normal file
10
docker-compose.build.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
version: '3.9'
|
||||||
|
services:
|
||||||
|
cic-custodial:
|
||||||
|
image: ${IMAGE_BASE_URL:-ghcr.io/grassrootseconomics/cic-custodial}/cic-custodial:${TAG:-latest}
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
cache_from:
|
||||||
|
- ${IMAGE_BASE_URL:-ghcr.io/grassrootseconomics/cic-custodial}/cic-cache:latest
|
||||||
|
|
@ -6,9 +6,15 @@ services:
|
|||||||
command: redis-server --loglevel warning
|
command: redis-server --loglevel warning
|
||||||
ports:
|
ports:
|
||||||
- '6379:6379'
|
- '6379:6379'
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "redis-cli ping | grep PONG"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:14-alpine
|
image: postgres:14-alpine
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
user: postgres
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_PASSWORD=postgres
|
- POSTGRES_PASSWORD=postgres
|
||||||
- POSTGRES_USER=postgres
|
- POSTGRES_USER=postgres
|
||||||
@ -17,18 +23,31 @@ services:
|
|||||||
- cic-custodial:/var/lib/postgresql/data
|
- cic-custodial:/var/lib/postgresql/data
|
||||||
ports:
|
ports:
|
||||||
- '5432:5432'
|
- '5432:5432'
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD-SHELL", "pg_isready"]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
asynqmon:
|
asynqmon:
|
||||||
image: hibiken/asynqmon
|
image: hibiken/asynqmon
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- '8080:8080'
|
- '8080:8080'
|
||||||
|
depends_on:
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
cic-custodial:
|
cic-custodial:
|
||||||
image: ghcr.io/grassrootseconomics/cic-custodial/cic-custodial:latest
|
image: ghcr.io/grassrootseconomics/cic-custodial/cic-custodial:latest
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
postgres:
|
||||||
|
condition: service_healthy
|
||||||
|
redis:
|
||||||
|
condition: service_healthy
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
ports:
|
ports:
|
||||||
- '8080:8080'
|
- '5000:5000'
|
||||||
volumes:
|
volumes:
|
||||||
cic-custodial:
|
cic-custodial:
|
||||||
driver: local
|
driver: local
|
||||||
|
Loading…
Reference in New Issue
Block a user