File tree 7 files changed +25
-12
lines changed 7 files changed +25
-12
lines changed Original file line number Diff line number Diff line change
1
+ FROM golang:latest AS buildContainer
2
+ WORKDIR /go/src/app
3
+ COPY . .
4
+ # flags: -s -w to remove symbol table and debug info
5
+ # CGO_ENALBED=0 is required for the code to run properly when copied alpine
6
+ RUN CGO_ENABLED=0 GOOS=linux go build -v -mod mod -ldflags "-s -w" -o restapi ./app
7
+
8
+ FROM alpine:latest
9
+ WORKDIR /app
10
+ COPY --from=buildContainer /go/src/app/restapi .
11
+
12
+ ENV DBUSER root
13
+ ENV DBPASSWORD jobs@123
14
+ ENV DBNAME api
15
+ ENV DBHOST localhost
16
+ ENV DBPORT 3306
17
+
18
+ EXPOSE 8080
19
+
20
+ CMD ["./restapi" ]
Original file line number Diff line number Diff line change 7
7
8
8
"github.com/gorilla/mux"
9
9
10
- emp "github.com/karanrn/go-rest-api/employee"
10
+ emp "github.com/karanrn/go-rest-api/app/ employee"
11
11
)
12
12
13
13
func TestGetEmployees (t * testing.T ) {
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import (
10
10
"strconv"
11
11
12
12
"github.com/gorilla/mux"
13
- "github.com/karanrn/go-rest-api/database"
13
+ "github.com/karanrn/go-rest-api/app/ database"
14
14
)
15
15
16
16
// Employee type holds information about an employee
Original file line number Diff line number Diff line change 8
8
"github.com/gorilla/mux"
9
9
"golang.org/x/time/rate"
10
10
11
- auth "github.com/karanrn/go-rest-api/authentication"
12
- emp "github.com/karanrn/go-rest-api/employee"
11
+ auth "github.com/karanrn/go-rest-api/app/ authentication"
12
+ emp "github.com/karanrn/go-rest-api/app/ employee"
13
13
)
14
14
15
15
const (
Original file line number Diff line number Diff line change @@ -8,11 +8,4 @@ services:
8
8
volumes :
9
9
- /home/karan/go/src/github.com/karanrn/go-rest-api/mysql/:/var/lib/mysql
10
10
environment :
11
- MYSQL_ROOT_PASSWORD : ${root_password}
12
- # deploy:
13
- # mode: replicated
14
- # replicas: 2
15
- # resources:
16
- # limits:
17
- # cpus: '0.50'
18
- # memory: 500M
11
+ MYSQL_ROOT_PASSWORD : ${root_password}
You can’t perform that action at this time.
0 commit comments