Skip to content

Commit

Permalink
use Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
dazz committed Jan 4, 2024
1 parent eb5f716 commit 4ff22f8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
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 @@ -63,10 +63,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 4ff22f8

Please sign in to comment.