File tree Expand file tree Collapse file tree 5 files changed +34
-0
lines changed Expand file tree Collapse file tree 5 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,8 @@ Feel free to ask for another project
53
53
- [ Gogs] ( gogs )
54
54
- [ Prometheus-Grafana] ( prometheus-grafana ) (based on https://github.com/axinorm/traefik-monitoring )
55
55
56
+ - [ Golang project example] ( golang-project-example )
57
+
56
58
57
59
## Informations
58
60
HTTPS is enabled by default, your certificates are generated and automatically renewed
Original file line number Diff line number Diff line change 1
1
services :
2
2
gogs :
3
3
image : gogs/gogs
4
+ restart : always
4
5
container_name : gogs
5
6
ports :
6
7
- " 10022:22"
@@ -50,3 +51,4 @@ networks:
50
51
traefik :
51
52
name : traefik_proxy
52
53
external : true
54
+ gogs :
Original file line number Diff line number Diff line change
1
+ MYSQL_USER=DB
2
+ MYSQL_PASSWORD=user
Original file line number Diff line number Diff line change
1
+ FROM golang:alpine
2
+ RUN apk add -U --no-cache git ca-certificates
3
+ WORKDIR /go
4
+ COPY go.mod go.sum /go/
5
+ RUN go mod download && go mod verify
6
+ COPY . .
7
+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-w -s" .
8
+ RUN echo "nobody:x:65534:65534:Nobody:/:" > /etc_passwd
9
+
10
+
11
+ FROM scratch
12
+
13
+ COPY --from=0 /etc_passwd /etc/passwd
14
+ COPY --from=0 /go/go /go
15
+ COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
16
+
17
+ USER nobody
18
+
19
+ EXPOSE 8080
20
+ ENV GIN_MODE=release
21
+ ENTRYPOINT ["/go" ]
Original file line number Diff line number Diff line change
1
+ ## Your Golang project example
2
+
3
+ An exemple with Golang Dockerfile
4
+
5
+ Dont forget to change the port ` 8080 ` if necessary and ` YOUR-DOMAIN ` in ` docker-compose.yml `
6
+
7
+ you can also change the name ` goproject `
You can’t perform that action at this time.
0 commit comments