Skip to content

Commit 33ae489

Browse files
authored
Merge branch 'master' into traefik-3
2 parents 45c2929 + 7a03af9 commit 33ae489

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Feel free to ask for another project
5353
- [Gogs](gogs)
5454
- [Prometheus-Grafana](prometheus-grafana) (based on https://github.com/axinorm/traefik-monitoring)
5555

56+
- [Golang project example](golang-project-example)
57+
5658

5759
## Informations
5860
HTTPS is enabled by default, your certificates are generated and automatically renewed

gogs/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
services:
22
gogs:
33
image: gogs/gogs
4+
restart: always
45
container_name: gogs
56
ports:
67
- "10022:22"
@@ -50,3 +51,4 @@ networks:
5051
traefik:
5152
name: traefik_proxy
5253
external: true
54+
gogs:

golang-project-example/.env.exemple

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MYSQL_USER=DB
2+
MYSQL_PASSWORD=user

golang-project-example/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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"]

golang-project-example/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
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`

0 commit comments

Comments
 (0)