Skip to content

Commit 4ff22f8

Browse files
committed
use Dockerfile
1 parent eb5f716 commit 4ff22f8

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

Dockerfile

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
# Stage 1: Build the Go binary
2-
FROM golang:1.17 AS builder
1+
# build stage
2+
FROM golang:1.20.12-alpine3.19 as builder
3+
4+
ENV GO111MODULE=on
35

4-
# Set the working directory inside the container
56
WORKDIR /app
67

7-
# Copy the go.mod and go.sum files to download dependencies
8-
COPY go.mod go.sum ./
8+
COPY go.mod .
9+
COPY go.sum .
910

10-
# Download dependencies
1111
RUN go mod download
1212

13-
# Copy the source code into the container
1413
COPY . .
1514

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

1918
# Stage 2: Create a minimal image for running the binary
2019
FROM scratch

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ nix:
6363
# RUN COMMANDS OF CLI WITH DEFAULT ARGS
6464
# ==================================================================================== #
6565

66+
## lint: lint s6-overlay folders and files
6667
.PHONY: lint
6768
lint:
6869
@go run ./cmd/s6cli $(ARGS) lint
6970

71+
## mermaid: generate mermaid graph
7072
.PHONY: mermaid
7173
mermaid:
7274
@go run ./cmd/s6cli $(ARGS) mermaid

0 commit comments

Comments
 (0)