Skip to content

Commit 53568c7

Browse files
authored
Merge pull request #32 from letsgo-framework/improve_docker_exp
docker working fine
2 parents 0011aec + 4764e8e commit 53568c7

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

Dockerfile

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
1-
FROM iron/go
1+
FROM golang as builder
2+
3+
ENV GO111MODULE=on
24

35
WORKDIR /app
46

5-
ADD letsgo /app/
7+
COPY go.mod .
8+
COPY go.sum .
9+
10+
RUN go mod download
11+
12+
COPY . .
13+
14+
RUN CGO_ENABLED=0 GODS=linux GOARCH=amd64 go build
15+
16+
FROM ubuntu
17+
18+
COPY --from=builder /app/letsgo /app/
19+
COPY --from=builder /app/.env /app/
20+
21+
RUN mkdir /app/log
622

7-
ENTRYPOINT ["./letsgo"]
23+
EXPOSE 8080
24+
ENTRYPOINT ["/app/letsgo"]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
[![Build Status](https://travis-ci.org/letsgo-framework/letsgo.svg?branch=master)](https://travis-ci.org/letsgo-framework/letsgo)
33
[![Go Report Card](https://goreportcard.com/badge/github.com/letsgo-framework/letsgo)](https://goreportcard.com/report/github.com/letsgo-framework/letsgo)
44
[![Coverage Status](https://coveralls.io/repos/github/letsgo-framework/letsgo/badge.svg?branch=master)](https://coveralls.io/github/letsgo-framework/letsgo?branch=master)
5+
[![Sourcegraph](https://sourcegraph.com/github.com/letsgo-framework/letsgo/-/badge.svg)](https://sourcegraph.com/github.com/letsgo-framework/letsgo?badge)
56
[![Join the chat at https://gitter.im/letsgo-framework/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/letsgo-framework/community)
67

78
## Go api starter

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "2"
2+
services:
3+
app:
4+
container_name: letsgo
5+
restart: always
6+
build: .
7+
ports:
8+
- "8080:8080"
9+
links:
10+
- mongo
11+
mongo:
12+
container_name: mongo
13+
image: mongo
14+
volumes:
15+
- /var/mongo/data:/data/db
16+
ports:
17+
- "27017:27017"

0 commit comments

Comments
 (0)