Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Official Docker Image with Travis CI integration #99

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -32,5 +32,9 @@ utils/bombardment
utils/siege.config
utils/siege2csv.pl

# Docker
docker/build/

# Others
tags

19 changes: 19 additions & 0 deletions .travis.yml
@@ -0,0 +1,19 @@
language: c

sudo: required

services:
- docker

before_install:
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
- docker pull ubuntu
- cd docker
- ./run.sh
- export REPO=jstarcher/siege
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
- docker build -t $REPO:$TAG .
- docker push $REPO

script:
- docker run --rm -t jstarcher/siege -c1 -r1 jstarcher.com
1 change: 1 addition & 0 deletions README.md
@@ -1,3 +1,4 @@
[![Build Status](https://travis-ci.org/jstarcher/siege.svg?branch=master)](https://travis-ci.org/jstarcher/siege)

Siege README

Expand Down
10 changes: 10 additions & 0 deletions docker/Dockerfile
@@ -0,0 +1,10 @@
FROM frolvlad/alpine-glibc:alpine-3.5

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would feel uneasy about relying on an unofficial base image.

Copy link

@futjikato futjikato Jul 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. But the problem is that alpine uses musl libc and so we have to get some glibc package in there because otherwise siege will just segfault.
Some other potential solution is to use an official alpine image and install https://github.com/sgerrand/alpine-pkg-glibc in the dockerfile but that means we rely on that as a somewhat sketchy other thingy.


COPY build/siege /usr/bin/siege
COPY build/siege.config /usr/bin/siege.config
COPY build/bombardment /usr/bin/bombardment

ENTRYPOINT ["siege"]

CMD ["--help"]

14 changes: 14 additions & 0 deletions docker/compile.sh
@@ -0,0 +1,14 @@
apt-get update \
&& apt-get install -y build-essential automake curl openssl jq zlib1g-dev \
&& LATEST=$(curl -s https://api.github.com/repos/JoeDog/siege/tags | jq --raw-output '.[0]["tarball_url"]') \
&& curl -L -o siege.tar.gz $LATEST \
&& tar xvvzf siege.tar.gz \
&& cd JoeDog* \
&& utils/bootstrap \
&& ./configure \
&& make \
&& make install \
&& cp /usr/local/bin/siege /opt/siege \
&& cp /usr/local/bin/bombardment /opt/siege \
&& cp /usr/local/bin/siege.config /opt/siege

7 changes: 7 additions & 0 deletions docker/run.sh
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

rm -rf build
mkdir build

docker run --rm -t -v $PWD/build:/opt/siege -v $PWD/compile.sh:/opt/compile.sh ubuntu bash /opt/compile.sh

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I like using the virtual package option of apk to install dependencies, compile, then uninstall dependencies - all in one layer. That way a single docker build results in a light, functional image - without the need for intermediary containers as in line 6.

docker build . -t jstarcher/siege:latest
2 changes: 2 additions & 0 deletions src/hash.c
Expand Up @@ -23,6 +23,8 @@
# include <config.h>
#endif/*HAVE_CONFIG_H*/

#include <sys/types.h>

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
Expand Down