99e8d311b10b00981c629e2c0abe55ccccf92116
- Author
- TheEdgeOfRage <git@theedgeofrage.com>
- Committer
- TheEdgeOfRage <git@theedgeofrage.com>
- Date
Message
build: compile container binary
Diff
1diff --git a/.dockerignore b/.dockerignore
2new file mode 100644
3index 0000000000000000000000000000000000000000..b1aa41b0315e88f54844b8c69f950aaf47651668
4--- /dev/null
5+++ b/.dockerignore
6@@ -0,0 +1,4 @@
7+.git
8+.env
9+data
10+soft
11diff --git a/Dockerfile b/Dockerfile
12index 9a583b90105207ce39945ebf88fe6c81f602e783..eb9f017a750b7dce87abab397973ef96ddf61052 100644
13--- a/Dockerfile
14+++ b/Dockerfile
15@@ -1,3 +1,13 @@
16+FROM golang:1.27-alpine AS build
17+
18+WORKDIR /src
19+
20+COPY go.mod go.sum ./
21+RUN go mod download
22+
23+COPY . .
24+RUN CGO_ENABLED=0 go build -trimpath -o soft ./cmd/soft
25+
26 FROM alpine:latest
27
28 # Create directories
29@@ -26,4 +36,4 @@ ENTRYPOINT [ "/usr/local/bin/soft", "serve" ]
30
31 RUN apk update && apk add --update git bash openssh && rm -rf /var/cache/apk/*
32
33-COPY soft /usr/local/bin/soft
34+COPY --from=build /src/soft /usr/local/bin/soft