Initial commit

This commit is contained in:
Alexandre Bruyant 2024-01-04 20:36:26 +01:00
commit bac001a5c2
4 changed files with 48 additions and 0 deletions

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
FROM golang:1.21 AS builder
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
WORKDIR /src
COPY . .
RUN go build \
-ldflags "-s -w -extldflags '-static'" \
-o /bin/app \
.
RUN echo "nobody:x:65534:65534:Nobody:/:" > /etc_passwd
FROM alpine:3.19 as compressor
RUN apk add --no-cache upx binutils
COPY --from=builder --chown=65534:0 /bin/app /app
RUN strip /app && upx -q -9 /app
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc_passwd /etc/passwd
COPY --from=compressor --chown=65534:0 /app /app
USER nobody
ENTRYPOINT ["/app"]

8
go.mod Normal file
View File

@ -0,0 +1,8 @@
module gitea.bruyant.xyz/alexandre/ipfs-node-pin
go 1.21.5
require (
github.com/sethvargo/go-envconfig v0.9.0 // indirect
github.com/sethvargo/go-githubactions v1.1.0 // indirect
)

4
go.sum Normal file
View File

@ -0,0 +1,4 @@
github.com/sethvargo/go-envconfig v0.9.0 h1:Q6FQ6hVEeTECULvkJZakq3dZMeBQ3JUpcKMfPQbKMDE=
github.com/sethvargo/go-envconfig v0.9.0/go.mod h1:Iz1Gy1Sf3T64TQlJSvee81qDhf7YIlt8GMUX6yyNFs0=
github.com/sethvargo/go-githubactions v1.1.0 h1:mg03w+b+/s5SMS298/2G6tHv8P0w0VhUFaqL1THIqzY=
github.com/sethvargo/go-githubactions v1.1.0/go.mod h1:qIboSF7yq2Qnaw2WXDsqCReM0Lo1gU4QXUWmhBC3pxE=

12
main.go Normal file
View File

@ -0,0 +1,12 @@
package main
import (
"github.com/sethvargo/go-githubactions"
)
func main() {
path := githubactions.GetInput("path_to_add")
if path == "" {
githubactions.Fatalf("Missing: path_to_add")
}
}