Skip to content

Commit adaf0a3

Browse files
committed
updated the build scripts, readme file
1 parent 88ae1c4 commit adaf0a3

File tree

4 files changed

+60
-78
lines changed

4 files changed

+60
-78
lines changed

build.sh

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ echo "CI: " $CI "TRAVIS: " $TRAVIS
44
echo "settting up"
55
./setup.sh
66

7+
echo "testing"
8+
go test
9+
710
echo "golang build"
811
go build -o hotel-api .
912

docker-build.log

+28-40
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,43 @@
1-
Sending build context to Docker daemon 557.1 kBSending build context to Docker daemon 1.114 MBSending build context to Docker daemon 1.671 MBSending build context to Docker daemon 2.228 MBSending build context to Docker daemon 2.785 MBSending build context to Docker daemon 3.342 MBSending build context to Docker daemon 3.899 MBSending build context to Docker daemon 4.456 MBSending build context to Docker daemon 5.014 MBSending build context to Docker daemon 5.571 MBSending build context to Docker daemon 6.128 MBSending build context to Docker daemon 6.685 MBSending build context to Docker daemon 7.242 MBSending build context to Docker daemon 7.539 MB
1+
Sending build context to Docker daemon 557.1 kBSending build context to Docker daemon 1.114 MBSending build context to Docker daemon 1.671 MBSending build context to Docker daemon 2.228 MBSending build context to Docker daemon 2.785 MBSending build context to Docker daemon 3.342 MBSending build context to Docker daemon 3.899 MBSending build context to Docker daemon 4.456 MBSending build context to Docker daemon 5.014 MBSending build context to Docker daemon 5.571 MBSending build context to Docker daemon 6.128 MBSending build context to Docker daemon 6.685 MBSending build context to Docker daemon 7.242 MBSending build context to Docker daemon 7.609 MB
22
Step 1 : FROM ubuntu:14.04
33
---> e17b56e5200a
44
Step 2 : MAINTAINER Daniel Portella
5-
---> Running in c3ca06218f0c
6-
---> 0e858f0c47da
7-
Removing intermediate container c3ca06218f0c
5+
---> Using cache
6+
---> f1e464cc74c9
87
Step 3 : LABEL version 1.0.0
9-
---> Running in 5fccb437b334
10-
---> e2ba0dbc6a64
11-
Removing intermediate container 5fccb437b334
8+
---> Using cache
9+
---> 1995eddc50f3
1210
Step 4 : LABEL description Go process example for docker.
13-
---> Running in faa541031f75
14-
---> eddc852b419f
15-
Removing intermediate container faa541031f75
11+
---> Using cache
12+
---> f826497ed227
1613
Step 5 : RUN mkdir api
17-
---> Running in dfff9e6375e7
18-
---> 45a94866ef9c
19-
Removing intermediate container dfff9e6375e7
14+
---> Using cache
15+
---> 90cef4ebecb5
2016
Step 6 : ADD hotel-api /api/
21-
---> 05c182ed9e6d
22-
Removing intermediate container e627d85b3651
17+
---> Using cache
18+
---> 8cb811c420c2
2319
Step 7 : RUN chmod +x /api/hotel-api
24-
---> Running in c7c740ed8909
25-
---> 9571dc1bbe9d
26-
Removing intermediate container c7c740ed8909
20+
---> Using cache
21+
---> 2de271b1fa0f
2722
Step 8 : ENV ENVIRONMENT development
28-
---> Running in ef27d02c29b3
29-
---> c7faf89e6bc2
30-
Removing intermediate container ef27d02c29b3
23+
---> Using cache
24+
---> 496bbeae65a2
3125
Step 9 : ENV BINDING :8080
32-
---> Running in db90cada1881
33-
---> 01aec4468bc0
34-
Removing intermediate container db90cada1881
26+
---> Using cache
27+
---> a67e3e45038b
3528
Step 10 : WORKDIR /api
36-
---> Running in fce2d81bd57d
37-
---> 4fd0b112aa33
38-
Removing intermediate container fce2d81bd57d
29+
---> Using cache
30+
---> 8c41b3fb9584
3931
Step 11 : RUN groupadd -r gogroup -g 433 && useradd -u 431 -r -g gogroup -d /api -s /sbin/nologin -c "go image user" go-user && chown -R go-user /api && chmod -R 774 /api
40-
---> Running in 905f0740431f
41-
---> c58113a62c79
42-
Removing intermediate container 905f0740431f
32+
---> Using cache
33+
---> 35beeafe5b42
4334
Step 12 : USER go-user
44-
---> Running in 2ac1a67ba222
45-
---> f46d4b626b91
46-
Removing intermediate container 2ac1a67ba222
35+
---> Using cache
36+
---> 243ffd6d4981
4737
Step 13 : EXPOSE 8080
48-
---> Running in 9c5048d71018
49-
---> 49b89f5c4139
50-
Removing intermediate container 9c5048d71018
38+
---> Using cache
39+
---> 8459c63027d4
5140
Step 14 : ENTRYPOINT /api/hotel-api
52-
---> Running in fe7402ccdeb5
53-
---> 7e341c55e077
54-
Removing intermediate container fe7402ccdeb5
55-
Successfully built 7e341c55e077
41+
---> Using cache
42+
---> 77d377368529
43+
Successfully built 77d377368529

readme.md

+29-38
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,47 @@
1-
# GO Lang in Docker and managed by Kubernetes
1+
# kubernetes-docker-golang
22

3-
This is a work in progress to get a go lang application containerized in docker and being managed in a kubernete cluster.
3+
Simple golang web site using mux to run on KUBERNETES or RANCHER and other docker management platforms.
44

55
[![Build Status](https://travis-ci.org/dmportella/kubernetes-docker-golang.svg?branch=master)](https://travis-ci.org/dmportella/kubernetes-docker-golang)
66

7-
## 0 - Dependencies
8-
**Note:** *Please note this has been developed and tests using a linux debian OS (mint distro)*
7+
## DOCKERHUB
98

10-
- Docker: http://www.docker.com/
11-
- Go Lang: https://golang.org/
12-
- kubernete: http://kubernetes.io/
9+
[![dockeri.co](http://dockeri.co/image/dmportella/golangweb)](https://hub.docker.com/r/dmportella/golangweb/)
1310

14-
## 1 - Building the solution
11+
## GOLANGWEB
1512

16-
The solution can be run by calling the *build.sh* file in the root of the repository.
13+
Simple golang site with route to simulate site failure.
1714

18-
> $ *bash build.sh*
15+
Built for testing *kubernetes* and *rancher* instances.
1916

20-
**Note:** *Please note this will run all the commands listed below which will build the app, build the container, run it and clean up by deleting the image locally.*
17+
### Normal route
2118

22-
### 1.1 - GO Lang App
19+
Web site should be available on port `8080`.
2320

24-
Simple hello world app running by defaul on port 8000.
21+
### Health check
22+
```
23+
GET /__health
24+
{
25+
version: "1.0.0",
26+
status: "OK"
27+
}
28+
```
29+
#### routes
30+
* Health check url.: `/__health/`
31+
* Set to throw 500: `/__health/throw500`
32+
* Set to time out: `/__health/timeout`
33+
* Set kill the process: `/__health/killprocess`
2534

26-
**To build run** *this will build a single package called hotel-api*
27-
28-
> $ *go build -o hotel-api .*
35+
## Building
2936

30-
### 1.2 - Build container
37+
The shell file `build.sh` will run npm install, install and run grunt and it will build and run the docker image.
3138

32-
This section has each command used to build and run the go container.
39+
> $ `./build.sh`
3340
34-
**Deletes all images with this name if you already have them**
41+
Builds docker image and tags it.
3542

36-
> $ *docker rmi hotel-api*
43+
> $ `./build-image.sh`
3744
38-
**Build docker Image**
45+
* Installs godep and other setup things
3946

40-
> $ *docker build -t hotel-api:latest .*
41-
42-
**Run docker instance dev mode**
43-
44-
> $ *docker run -it --rm --name hotel-api --publish 8000:8000 hotel-api*
45-
46-
## 2 - Kubernetes
47-
48-
This is a work in progress but replication controller, the pod and service files are done.
49-
50-
Not tested it yet as I am still working on my kubernete environment which I am planning to automate the creation of it and put it here.
51-
52-
## License
53-
54-
See license file included in the repository.
55-
56-
...Hmmm Muffins
47+
> $ `./setup.sh`

setup.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)