Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mefellows/demo-docker-go-api

Demo/Test Application: Golang Microservice deployed to a minimal Docker container
https://github.com/mefellows/demo-docker-go-api

Last synced: about 2 months ago
JSON representation

Demo/Test Application: Golang Microservice deployed to a minimal Docker container

Awesome Lists containing this project

README

        

# Golang Docker Microservice

## Getting Started

* Install Docker and Boot2Docker (`brew install docker boot2docker`)
* Install the Go cross-compiler [Gox](https://github.com/mitchellh/gox)

```
go get github.com/mitchellh/gox
gox -build-toolchain
```

## Build and Run application in Docker

```
time gox -osarch="linux/amd64" -output="micro-go" && docker build -t mfellows/micro-go . && docker run --name api --rm -i -t -p 8000:8000 mfellows/micro-go
```

This will build a binary for 64bit linux with the name `micro-go`, create a Docker image and then run the image exposing port `8000`.

The API is now running on port 8000, `curl` until your heart is content:

```
curl $(boot2docker ip):8000/hello/peeps
```