Comments (12)
I just released my Docker Container which runs gin. https://github.com/ntboes/docker-golang-gin https://registry.hub.docker.com/u/ntboes/golang-gin/
Usage:
docker run --name some-instance-name -v $(pwd):/go/src/app ntboes/golang-gin -p 4000
from gin.
Are you intending to use this in a production or a development environment.
gin wasn't originally intended to run in production, but you use case interests me
from gin.
My idea was to have gin running in a container and have the code in a volume. Thus, when you git pull
on the host machine you get the new code deployed automatically. The issue is that you lose control of dependencies, as you can't go get
inside the container. Anyway, I think this might be an interesting model for CD, albeit slightly silly.
from gin.
You can use gin with Vagrant and the official golang image like this:
Vagrantfile
config.vm.define "app" do |v|
v.vm.synced_folder ".", "/vagrant", disabled: true
v.vm.synced_folder ".", "/go/src/app"
v.vm.provider "docker" do |d|
d.build_dir = "."
d.ports = ["80:3000"]
end
end
Dockerfile
FROM golang:onbuild
RUN go get github.com/codegangsta/gin
CMD ["gin"]
EXPOSE 3000
from gin.
While using the golang:1.4-wheezy
and a simple martini example within a docker container, I get http: proxy error: dial tcp 127.0.0.1:3001: connection refused
.
from gin.
Here's the dockerfile and example code I'm using:
https://gist.github.com/caiges/3527b9213ce841f511fe
and the command I'm using:
gin --path /opt/helloworld /opt/helloworld/main.go
from gin.
When I integrate Gin within Docker I receive this error message:
"/go/bin/gin: 1: /go/bin/gin: Syntax error: "(" unexpected"
Any ideas?
from gin.
Hmm, haven't observed that behavior. Can you link your code?
from gin.
It´s a concept test only:
[server.go]
package main
import "github.com/go-martini/martini"
func main() {
m := martini.Classic()
m.Get("/", func() string {
return "Hello world!"
})
m.Run()
}
[Dockerfile]
FROM ubuntu:13.10
RUN apt-get update
RUN apt-get install -y build-essential mercurial git subversion wget curl
bzr
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install golang
RUN mkdir /go
RUN export GOPATH=/go
ENV GOPATH /go
RUN export PATH=$PATH:$GOPATH/bin
ENV PATH $PATH:$GOPATH/bin
WORKDIR /go
RUN go get github.com/tools/godep
RUN go get github.com/go-martini/martini
RUN go get github.com/codegangsta/gin
CMD go install lifes.com && gin --path src/lifes.com/ src/
lifes.com/server.go
2015-01-27 18:18 GMT+01:00 Caige Nichols [email protected]:
Hmm, haven't observed that behavior. Can you link your code?
—
Reply to this email directly or view it on GitHub
#35 (comment).
from gin.
Hmm, might be something in the lifes.com repo you're using. I slightly modified your Dockerfile, built with docker built -t testapp
and was able to run docker run testapp gin --path /usr/src/app /usr/src/app/main.go
from gin.
Yeah! Thanks caiges! now this part is working but now I received the following error message:
$ docker run -p 3000:3000 lifes-server gin --path src/lifes.com/ src/lifes.com/server.go
[gin] listening on port 3000
2015/01/27 18:33:52 http: proxy error: dial tcp 127.0.0.1:3001: connection refused
Any ideas?
Thank you so much!
from gin.
@Raul-diffindo I had the same error when I was running without the CGO_ENABLED=0 flag
from gin.
Related Issues (20)
- Support for args on binary HOT 2
- gRPC usage HOT 2
- error while access to url localhost:8080 HOT 4
- Feature request: Support TLS backends HOT 4
- Go get gin can't find urfave module HOT 4
- flag provided but not defined: -immediate HOT 1
- No connection could be made because the target machine actively refused it
- Upgrade wercker build to use docker version
- Auto assign port for proxy server
- Incorrect Usage: flag provided but not defined: -appPort HOT 3
- Build fails
- Has this project been abandoned? HOT 2
- go
- Broken build HOT 4
- Can add a monitoring build for static files?
- command.ProcessState could be nil
- No error log when use gin with dlv for remote debug. HOT 1
- Perhaps suggest go install command instead of go get HOT 1
- My file content hasn't changed, but gin always executes building.
- This exception occurs frequently
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gin.