Skip to content
This repository was archived by the owner on Nov 6, 2021. It is now read-only.

Dockerize a Go on Rails application

B1nj0y edited this page Jan 8, 2018 · 19 revisions

One of Golang's smart features is its app could be compiled as a single executable binary. That's convenient for release and deployment.

But we can't compile the assets like stylesheet, javascript and images into this binary by a common go build. Of course there're some solutions indeed, but I don't take it an idiomatic way, and sometimes it's not fit well with some framework like Gin.

In fact Docker is very nice solution for Golang web app release and deployment. So go-on-rails will generate a Dockerfile at meanwhile when generating the application. You can find a Dockerfile in the go_app folder.

Now just run make image will build a docker image for the generated Golang app.

The docker image names after a format like USER/IMAGE:TAG, you can pass the values as arguments to make image command:

make image USER=goonr IMAGE=nice_app TAG=1.2.0

Your system username and other default values(IMAGE=myapp and TAG=latest) will be used if you omit them.

Clone this wiki locally