Browse Source

Add code to create signed debian packages & host them on s3

docs-docker
Tim Dysinger 7 years ago
parent
commit
1083a9331b
  1. 4
      .dockerignore
  2. 1
      .gitignore
  3. 24
      Makefile
  4. 38
      README.md
  5. 56
      etc/Dockerfile

4
.dockerignore

@ -0,0 +1,4 @@
/.cabal-sandbox
/cabal*.config
/dist
/target

1
.gitignore

@ -13,3 +13,4 @@ cabal.sandbox.config
/.cabal-sandbox/
.shake/
.stack-work/
/target/

24
Makefile

@ -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

38
README.md

@ -10,6 +10,44 @@ For more details on how stack works internally, please see [the architecture
document](ARCHITECTURE.md). **FIXME more correct link once moved to final repo
location**
### Install
* Ubuntu 15.04 (amd64)
```sh
wget -q -O- https://fpco.s3.amazonaws.com/fpco.key | sudo apt-key add -
echo 'deb http://fpco.s3.amazonaws.com/ubuntu/vivid stable main'|sudo tee /etc/apt/sources.list.d/fpco.list
sudo apt-get update
sudo apt-get install stack -y
```
* Ubuntu 14.10 (amd64)
```sh
wget -q -O- https://fpco.s3.amazonaws.com/fpco.key | sudo apt-key add -
echo 'deb http://fpco.s3.amazonaws.com/ubuntu/utopic stable main'|sudo tee /etc/apt/sources.list.d/fpco.list
sudo apt-get update
sudo apt-get install stack -y
```
* Ubuntu 14.04 (amd64)
```sh
wget -q -O- https://fpco.s3.amazonaws.com/fpco.key | sudo apt-key add -
echo 'deb http://fpco.s3.amazonaws.com/ubuntu/trusty stable main'|sudo tee /etc/apt/sources.list.d/fpco.list
sudo apt-get update
sudo apt-get install stack -y
```
* Ubuntu 12.04 (amd64)
```sh
wget -q -O- https://fpco.s3.amazonaws.com/fpco.key | sudo apt-key add -
echo 'deb http://fpco.s3.amazonaws.com/ubuntu/precise stable main'|sudo tee /etc/apt/sources.list.d/fpco.list
sudo apt-get update
sudo apt-get install stack -y
```
### Usage
1. Download stack following the instructions at **FIXME** and place it on your `PATH`

56
etc/Dockerfile

@ -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/
Loading…
Cancel
Save