download tarball
tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
export go path in /etc/profile
# Version: 1.0.0
# Create Time: 2018-07-20
# Author: Jason Tu
# Description: Microservice Audit log img
FROM golang:latest
# Install golang library
RUN go get github.com/gin-gonic/gin && go get github.com/go-sql-driver/mysql \
&& go get github.com/codegangsta/gin
# Expose the application on port 8080
EXPOSE 8080
# Set the entry point of the container to the bee command that runs the
# application and watches for changes
CMD ["gin", "run", "*.go"]
# or CMD ["/bin/bash"]
docker run -i -d --rm --name auditlog_ms -p 8080:3000 -v /root/gin_playground/auditlog_ms:/go/src/auditlog_ms -w /go/src/auditlog_ms auditlog_ms:base
or
docker run -it --rm --name auditlog_ms -p 8080:3000 -v /root/gin_playground/auditlog_ms:/go/src/auditlog_ms -w /go/src/auditlog_ms auditlog_ms:base
# Version: 1.0.0
# Create Time: 2018-07-20
# Author: Jason Tu
# Description: Microservice Audit log img
FROM golang:latest
# Create the directory where the application will reside
RUN mkdir /app
ADD auditlog_ms /app/auditlog_ms
ADD conf /app/conf
WORKDIR /app
EXPOSE 8080
# Set the entry point of the container to the application executable
ENTRYPOINT /app/auditlog_ms
docker run -i -d --rm --name auditlog_ms_prod -p 8081:3001 auditlog_ms:prod
go get -u github.com/kardianos/govendor
# then build govendor
# goto src code folder
govendor init
govendor add +external
# commit the library code