Git Product home page Git Product logo

gomicroservice's Introduction

#Test dockerize main.go copyright from original developer. #Pre-install

go get github.com/dahernan/godockerize
go get github.com/tools/godep
wget https://github.com/docker-library/golang/blob/master/go-wrapper

#Build To generate for Dockerfile

godep save
godockerize -expose 3001

then

docker build -t gomicroservice .

then

docker run --rm  -p 8080:8080  gomicroservice

#Workaround if you can't download FROM golang:stable in the first Dockerfile use following lines instead.

FROM buildpack-deps:jessie-scm

RUN apt-get update && apt-get install -y \
        gcc libc6-dev make \
                --no-install-recommends \
                    && rm -rf /var/lib/apt/lists/*

                    ENV GOLANG_VERSION 1.4.2

                    RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
                            | tar -v -C /usr/src -xz

                            RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1

                            ENV PATH /usr/src/go/bin:$PATH

                            RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
                            ENV GOPATH /go
                            ENV PATH /go/bin:$PATH
                            WORKDIR /go

                            COPY go-wrapper /usr/local/bin/

#Workaround 2

if docker build fail, remove -d for the following line in Dockerfile

RUN cd $APP_DIR && CGO_ENABLED=0 go build -o /opt/app/gomicroservice -ldflags '-d -w -s'

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.