1
0
mirror of https://github.com/schollz/cowyo.git synced 2023-08-10 21:13:00 +03:00

Merge pull request #84 from yamilurbina/adding_dockerfile

Added Dockerfile to generate a small docker image
This commit is contained in:
Zack 2017-10-15 08:50:44 -06:00 committed by GitHub
commit da30d15eb1
4 changed files with 38 additions and 1 deletions

3
.gitignore vendored
View File

@ -22,3 +22,6 @@ _testmain.go
*.exe *.exe
*.test *.test
*.prof *.prof
data/*
cowyo

25
Dockerfile Normal file
View File

@ -0,0 +1,25 @@
# First build step
FROM golang:1.9-alpine as builder
WORKDIR /go/src/cowyo
COPY . .
# Disable crosscompiling
ENV CGO_ENABLED=0
# Install git and make, compile and cleanup
RUN apk add --no-cache git make \
&& go get -u github.com/schollz/cowyo \
&& go get -u github.com/jteeuwen/go-bindata/... \
&& make \
&& apk del --purge git make \
&& rm -rf /var/cache/apk*
# Second build step uses the minimal scratch Docker image
FROM scratch
# Copy the binary from the first step
COPY --from=builder /go/src/cowyo/cowyo /usr/local/bin/cowyo
# Expose data folder
VOLUME /data
EXPOSE 8050
# Start cowyo listening on any host
CMD ["cowyo", "--host", "0.0.0.0"]

View File

@ -2,7 +2,7 @@
# make -j4 release # make -j4 release
VERSION=$(shell git describe) VERSION=$(shell git describe)
LDFLAGS=-ldflags "-s -w -X main.version=${VERSION}" LDFLAGS=-ldflags "-s -w -X main.version=${VERSION}" -a -installsuffix cgo
.PHONY: build .PHONY: build
build: build:

9
docker-compose.yml Normal file
View File

@ -0,0 +1,9 @@
version: "2"
services:
cowyo:
build: .
ports:
- 8050:8050
volumes:
- ./data:/data