Skip to content
This repository has been archived by the owner on Jun 21, 2018. It is now read-only.

Commit

Permalink
replaced goxc with Docker+fpm workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dAnjou committed Oct 3, 2016
1 parent f2e0d98 commit 8746f27
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 14 deletions.
14 changes: 0 additions & 14 deletions .goxc.json

This file was deleted.

42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM golang:1.7

ENV goup_version 0.2.1

# install fpm
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ruby \
ruby-dev \
gcc \
make \
rpm \
&& rm -rf /var/lib/apt/lists/* \
&& gem install fpm

# install govendor
RUN wget --no-verbose -O /usr/local/bin/govendor https://github.com/kardianos/govendor/releases/download/v1.0.8/govendor_linux_amd64 \
&& chmod +x /usr/local/bin/govendor

# create volume for files and directories to be served by Goup
RUN mkdir /data
VOLUME /data

# create directory for Goup binary and packages
RUN mkdir /builds

# build Goup
RUN mkdir -p /go/src/goup
WORKDIR /go/src/goup
COPY . /go/src/goup
RUN govendor sync
RUN go build -o /builds/goup -ldflags "-X main.VERSION=$goup_version" -v .

# create DEB and RPM packages
WORKDIR /builds
RUN fpm -s dir -t deb --name goup --version $goup_version ./goup=/usr/local/bin/goup
RUN fpm -s dir -t rpm --name goup --version $goup_version ./goup=/usr/local/bin/goup

EXPOSE 4000

WORKDIR /go/src/goup
CMD ["go-wrapper", "run", "-dir", "/data"]
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
GOUP_IMAGE ?= goup
GOUP_PORT ?= 4000
GOUP_DIR ?= $(PWD)

image:
docker build --tag $(GOUP_IMAGE) .

builds: image
GOUP_CONTAINER=$$(docker create $(GOUP_IMAGE)) && \
docker cp $$GOUP_CONTAINER:/builds . ; \
docker rm $$GOUP_CONTAINER

run: image
docker run --rm -v $(GOUP_DIR):/data -p $(GOUP_PORT):4000 $(GOUP_IMAGE)

0 comments on commit 8746f27

Please sign in to comment.