-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from fpco/ubuntu-packages
Add code to create signed debian/ubuntu packages & host them on s3
- Loading branch information
Showing
5 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.cabal-sandbox | ||
/cabal*.config | ||
/dist | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ cabal.sandbox.config | |
/.cabal-sandbox/ | ||
.shake/ | ||
.stack-work/ | ||
/target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
PKG_VERSION := $(shell cat stack.cabal|grep -e '^version:'|cut -d':' -f2|sed 's/\s//g') | ||
GIT_REV_COUNT := $(shell git rev-list HEAD --count) | ||
GIT_SHA := $(shell PAGER=cat git log --pretty=%h HEAD~1..HEAD) | ||
UBUNTU_VERSION ?= 15.04 | ||
|
||
default: $(DIR)/target/ubuntu-$(UBUNTU_VERSION)/stack_$(PKG_VERSION)-$(GIT_REV_COUNT)-$(GIT_SHA)_amd64.deb | ||
|
||
$(DIR)/target/ubuntu-$(UBUNTU_VERSION): | ||
@mkdir -p $(DIR)/target/ubuntu-$(UBUNTU_VERSION) | ||
|
||
$(DIR)/target/ubuntu-$(UBUNTU_VERSION)/stack_$(PKG_VERSION)-$(GIT_REV_COUNT)-$(GIT_SHA)_amd64.deb: | $(DIR)/target/ubuntu-$(UBUNTU_VERSION) | ||
@cp $(DIR)/etc/Dockerfile $(DIR)/Dockerfile | ||
@perl -p -i -e "s/<<UBUNTU_VERSION>>/$(UBUNTU_VERSION)/g" $(DIR)/Dockerfile | ||
@perl -p -i -e "s/<<PKG_VERSION>>/$(PKG_VERSION)/g" $(DIR)/Dockerfile | ||
@perl -p -i -e "s/<<GIT_REV_COUNT>>/$(GIT_REV_COUNT)/g" $(DIR)/Dockerfile | ||
@perl -p -i -e "s/<<GIT_SHA>>/$(GIT_SHA)/g" $(DIR)/Dockerfile | ||
@docker build --rm=false --tag=stack-$(UBUNTU_VERSION):$(PKG_VERSION)-$(GIT_REV_COUNT)-$(GIT_SHA) $(DIR) | ||
@docker run --rm -v $(DIR)/target/ubuntu-$(UBUNTU_VERSION):/mnt stack-$(UBUNTU_VERSION):$(PKG_VERSION)-$(GIT_REV_COUNT)-$(GIT_SHA) | ||
|
||
clean: | ||
@rm -f $(DIR)/Dockerfile $(DIR)/target | ||
|
||
.PHONY: clean default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#-*- mode:conf; -*- | ||
|
||
FROM ubuntu:<<UBUNTU_VERSION>> | ||
|
||
ENV DEBIAN_FRONTEND noninteractive | ||
ENV LANG en_US.UTF-8 | ||
RUN locale-gen $LANG | ||
|
||
# NOTE: This next block can speed up your repeat assembly times | ||
# significantly. Uncomment to allow. Requires apt-cacher-ng running on | ||
# the docker host. | ||
RUN apt-get update | ||
RUN apt-get install -y net-tools | ||
RUN echo "Acquire::http { Proxy \"http://$(netstat -nr|grep '^0\.0\.0\.0'|awk '{print $2}'):3142\"; };" \ | ||
| tee /etc/apt/apt.conf.d/02proxy | ||
|
||
# HASKELL | ||
ENV GHCVER=7.8.4 | ||
ENV CABALVER=1.20 | ||
RUN apt-get update | ||
RUN apt-get install -y python-software-properties | ||
RUN apt-add-repository -y ppa:hvr/ghc | ||
RUN apt-get update | ||
RUN apt-get install -y ghc-$GHCVER cabal-install-$CABALVER zlib1g-dev wget | ||
ENV PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH | ||
|
||
# RUBY & FPM | ||
RUN apt-get install -y ruby-dev rubygems libffi-dev make | ||
RUN gem install fpm | ||
|
||
# BUILD | ||
ADD ./ /usr/src/ | ||
WORKDIR /usr/src/ | ||
RUN rm -rf .cabal-sandbox cabal*config dist | ||
RUN wget http://www.stackage.org/lts/cabal.config | ||
RUN cabal update | ||
RUN cabal sandbox init | ||
RUN cabal install -j --ghc-options='-rtsopts -threaded -with-rtsopts=-N' cpphs . | ||
|
||
# DEB PKG | ||
RUN mkdir -p /var/tmp/fpm/stack_<<PKG_VERSION>>-<<GIT_REV_COUNT>>-<<GIT_SHA>>/usr/bin | ||
RUN cp .cabal-sandbox/bin/stack /var/tmp/fpm/stack_<<PKG_VERSION>>-<<GIT_REV_COUNT>>-<<GIT_SHA>>/usr/bin/ | ||
RUN fpm \ | ||
-s dir \ | ||
-t deb \ | ||
-n stack \ | ||
-v <<PKG_VERSION>>-<<GIT_REV_COUNT>>-<<GIT_SHA>> \ | ||
-d libc6 \ | ||
-d libgmp10 \ | ||
-C /var/tmp/fpm/stack_<<PKG_VERSION>>-<<GIT_REV_COUNT>>-<<GIT_SHA>> \ | ||
-p /stack_<<PKG_VERSION>>-<<GIT_REV_COUNT>>-<<GIT_SHA>>_amd64.deb \ | ||
usr | ||
|
||
# SHIP THE DEB TO THE HOST O.S. | ||
VOLUME /mnt | ||
CMD cp /stack_<<PKG_VERSION>>-<<GIT_REV_COUNT>>-<<GIT_SHA>>_amd64.deb /mnt/ |