Skip to content

Commit

Permalink
Merge branch 'main' of github.com:dazz/s6-cli into main
Browse files Browse the repository at this point in the history
  • Loading branch information
dazz committed Jan 4, 2024
2 parents 241d15b + 9ba7769 commit f07db26
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 9 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/continuous-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ci

on: [push]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.20', '1.21.x' ]

steps:
- uses: actions/checkout@v4
- name: Setup Go ${{ matrix.go-version }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install dependencies
run: go get .
- name: Build
run: go build -v ./...
- name: Test with the Go CLI
run: go test
28 changes: 28 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: release

on:
create

jobs:
docker:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: hakindazz/s6-cli:latest
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
# Stage 1: Build the Go binary
FROM golang:1.17 AS builder
# build stage
FROM golang:1.20.12-alpine3.19 as builder

ENV GO111MODULE=on

# Set the working directory inside the container
WORKDIR /app

# Copy the go.mod and go.sum files to download dependencies
COPY go.mod go.sum ./
COPY go.mod .
COPY go.sum .

# Download dependencies
RUN go mod download

# Copy the source code into the container
COPY . .

# Build the Go binary
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o s6-cli .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o s6-cli -v ./cmd/s6cli


# Stage 2: Create a minimal image for running the binary
FROM scratch
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ nix:
# RUN COMMANDS OF CLI WITH DEFAULT ARGS
# ==================================================================================== #

## lint: lint s6-overlay folders and files
.PHONY: lint
lint:
@go run ./cmd/s6cli $(ARGS) lint

## mermaid: generate mermaid graph
.PHONY: mermaid
mermaid:
@go run ./cmd/s6cli $(ARGS) mermaid
Expand Down

0 comments on commit f07db26

Please sign in to comment.