Code Monkey home page Code Monkey logo

Comments (12)

ntboes avatar ntboes commented on June 7, 2024 1

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.

codegangsta avatar codegangsta commented on June 7, 2024

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.

andreis avatar andreis commented on June 7, 2024

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.

jephir avatar jephir commented on June 7, 2024

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.

caiges avatar caiges commented on June 7, 2024

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.

caiges avatar caiges commented on June 7, 2024

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.

Raul-diffindo avatar Raul-diffindo commented on June 7, 2024

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.

caiges avatar caiges commented on June 7, 2024

Hmm, haven't observed that behavior. Can you link your code?

from gin.

Raul-diffindo avatar Raul-diffindo commented on June 7, 2024

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.

caiges avatar caiges commented on June 7, 2024

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.

Raul-diffindo avatar Raul-diffindo commented on June 7, 2024

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.

HermannBjorgvin avatar HermannBjorgvin commented on June 7, 2024

@Raul-diffindo I had the same error when I was running without the CGO_ENABLED=0 flag

from gin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.