Skip to content

Commit

Permalink
Latest and greatest
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgodbolt committed Feb 7, 2015
1 parent 25a0d83 commit fbe08cc
Show file tree
Hide file tree
Showing 14 changed files with 136 additions and 50 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ all: docker-images

DOCKER := sudo docker

docker-images: gcc-explorer-image d-explorer-image rust-explorer-image
docker-images: gcc-explorer-image d-explorer-image rust-explorer-image gcc-explorer-image-1204

.s3cfg: config.py
echo 'from config import *; print "[default]\\naccess_key = {}\\nsecret_key={}\\n" \
.format(S3_ACCESS_KEY, S3_SECRET_KEY)' | python > $@

docker/gcc-explorer/.s3cfg: .s3cfg
cp $< $@
docker/gcc-explorer-1204/.s3cfg: .s3cfg
cp $< $@
docker/d-explorer/.s3cfg: .s3cfg
cp $< $@
docker/rust-explorer/.s3cfg: .s3cfg
Expand All @@ -19,6 +21,9 @@ docker/rust-explorer/.s3cfg: .s3cfg
gcc-explorer-image: docker/gcc-explorer/.s3cfg
$(DOCKER) build -t "mattgodbolt/gcc-explorer:gcc" docker/gcc-explorer

gcc-explorer-image-1204: docker/gcc-explorer-1204/.s3cfg
$(DOCKER) build -t "mattgodbolt/gcc-explorer:gcc1204" docker/gcc-explorer-1204

d-explorer-image: docker/d-explorer/.s3cfg
$(DOCKER) build -t "mattgodbolt/gcc-explorer:d" docker/d-explorer

Expand Down
3 changes: 2 additions & 1 deletion docker/d-explorer/run.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

set -ex
. /site.sh

git clone -b release --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer
git clone -b ${BRANCH} --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer
cd /gcc-explorer
make prereqs GDC=/usr/bin/gdc-4.9
nodejs app.js --env amazon-d
56 changes: 56 additions & 0 deletions docker/gcc-explorer-1204/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM ubuntu:12.04
MAINTAINER Matt Godbolt <[email protected]>

RUN apt-get -y update && apt-get install -y python-software-properties
RUN add-apt-repository -y ppa:chris-lea/node.js && add-apt-repository -y ppa:ubuntu-toolchain-r/test

RUN apt-get -y update && apt-get install -y \
curl \
git \
make \
nodejs \
s3cmd \
clang \
g++ \
g++-4.4 \
g++-4.5 \
g++-4.5-arm-linux-gnueabi \
g++-4.6 \
g++-4.6-arm-linux-gnueabi \
g++-4.7 \
g++-4.7-multilib \
g++-4.8 \
g++-4.8-multilib \
gcc-4.4 \
gcc-4.5 \
gcc-4.6 \
gcc-4.7-base \
gcc-4.7-multilib \
gcc-4.8 \
gcc-4.8-multilib \
gcc-avr \
gcc-msp430 \
gcc-snapshot

RUN mkdir -p /root
RUN mkdir -p /root/.ssh
COPY .s3cfg /root/
COPY known_hosts /root/.ssh/
COPY compilers.sh /root/
RUN bash /root/compilers.sh
RUN rm /root/compilers.sh
RUN rm /root/.s3cfg
RUN apt-get purge -y curl s3cmd openjdk-6-jre-lib
RUN apt-get autoremove -y
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

#####################
RUN useradd gcc-user && mkdir -p /gcc-explorer /home/gcc-user && chown gcc-user /gcc-explorer && chown gcc-user /home/gcc-user
ENV HOME /home/gcc-user
COPY run.sh /

USER gcc-user
WORKDIR /gcc-explorer
EXPOSE 20480
CMD ["/run.sh"]
20 changes: 20 additions & 0 deletions docker/gcc-explorer-1204/compilers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#/bin/bash

set -e
cd /opt

for compiler in clang-3.2.tar.gz \
clang-3.3.tar.gz \
gcc-4.9.0-0909-concepts.tar.gz \
gcc-4.9.0-with-concepts.tar.gz \
gcc-4.9.0.tar.gz \
intel.tar.gz \
; do
s3cmd --config /root/.s3cfg get s3://gcc-explorer/opt/$compiler /opt/$compiler
tar zxf $compiler
rm $compiler
done

curl http://llvm.org/releases/3.4.1/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04.tar.xz | tar Jxf -

find /opt -executable -type f | xargs strip || true
2 changes: 2 additions & 0 deletions docker/gcc-explorer-1204/known_hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
|1|6kkg4vXFndu74Cif5Oz9098PsY4=|k0sy2nylJdzYTwQK+aKmITvX8S8= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
|1|9zKzfbCf91lj6RBfxx8gmxHV7Lc=|9JCgnqPKdeIaFvFF0tijjEgBWOk= ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==
10 changes: 10 additions & 0 deletions docker/gcc-explorer-1204/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -ex

. /site.sh

git clone -b ${BRANCH} --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer
cd /gcc-explorer
make prereqs
nodejs app.js --env amazon1204
28 changes: 6 additions & 22 deletions docker/gcc-explorer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:12.04
FROM ubuntu:14.04
MAINTAINER Matt Godbolt <[email protected]>

RUN apt-get -y update && apt-get install -y python-software-properties
RUN apt-get -y update && apt-get install -y python-software-properties software-properties-common
RUN add-apt-repository -y ppa:chris-lea/node.js && add-apt-repository -y ppa:ubuntu-toolchain-r/test

RUN apt-get -y update && apt-get install -y \
Expand All @@ -10,27 +10,11 @@ RUN apt-get -y update && apt-get install -y \
make \
nodejs \
s3cmd \
clang \
g++ \
g++-4.4 \
g++-4.5 \
g++-4.5-arm-linux-gnueabi \
g++-4.6 \
g++-4.6-arm-linux-gnueabi \
g++-4.7 \
g++-4.7-multilib \
clang-3.5 \
g++-4.8 \
g++-4.8-multilib \
gcc-4.4 \
gcc-4.5 \
gcc-4.6 \
gcc-4.7-base \
gcc-4.7-multilib \
gcc-4.8 \
gcc-4.8-multilib \
gcc-avr \
gcc-msp430 \
gcc-snapshot
g++-4.8-powerpc-linux-gnu \
g++-arm-linux-gnueabihf \
g++-aarch64-linux-gnu

RUN mkdir -p /root
RUN mkdir -p /root/.ssh
Expand Down
14 changes: 0 additions & 14 deletions docker/gcc-explorer/compilers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,4 @@
set -e
cd /opt

for compiler in clang-3.2.tar.gz \
clang-3.3.tar.gz \
gcc-4.9.0-0909-concepts.tar.gz \
gcc-4.9.0-with-concepts.tar.gz \
gcc-4.9.0.tar.gz \
intel.tar.gz \
; do
s3cmd --config /root/.s3cfg get s3://gcc-explorer/opt/$compiler /opt/$compiler
tar zxf $compiler
rm $compiler
done

curl http://llvm.org/releases/3.4.1/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04.tar.xz | tar Jxf -

find /opt -executable -type f | xargs strip || true
4 changes: 3 additions & 1 deletion docker/gcc-explorer/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

set -ex

git clone -b release --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer
. /site.sh

git clone -b ${BRANCH} --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer
cd /gcc-explorer
make prereqs
nodejs app.js --env amazon
4 changes: 3 additions & 1 deletion docker/rust-explorer/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

set -ex

git clone -b release --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer
. /site.sh

git clone -b ${BRANCH} --depth 1 https://github.com/mattgodbolt/gcc-explorer.git /gcc-explorer
cd /gcc-explorer
make prereqs
nodejs app.js --env amazon-rust
2 changes: 2 additions & 0 deletions gcc-explorer.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ script
set -e
HOME=/root
export HOME
DEV_MODE=0
export DEV_MODE
mkfifo /tmp/gcc-explorer-log
( logger -t gcc </tmp/gcc-explorer-log & )
exec >/tmp/gcc-explorer-log
Expand Down
32 changes: 22 additions & 10 deletions run_site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,40 @@

set -ex

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SUDO=sudo
if [[ $UID = 0 ]]; then
SUDO=
fi

$SUDO docker pull mattgodbolt/gcc-explorer
EXTERNAL_PORT=80
CONFIG_FILE=${DIR}/site-prod.sh
if [[ ${DEV_MODE=1} = 1 ]]; then
EXTERNAL_PORT=8000
CONFIG_FILE=${DIR}/site-dev.sh
else
$SUDO docker pull mattgodbolt/gcc-explorer
fi

ALL="gcc gcc1204 d rust nginx"
$SUDO docker stop ${ALL} || true
$SUDO docker rm ${ALL} || true

$SUDO docker stop gcc d rust nginx || true
$SUDO docker rm gcc d rust nginx || true
CFG="-v ${CONFIG_FILE}:/site.sh:ro"

GCC=$(sudo docker run --name gcc -d -p 10240:10240 mattgodbolt/gcc-explorer:gcc)
D=$(sudo docker run --name d -d -p 10241:10241 mattgodbolt/gcc-explorer:d)
RUST=$(sudo docker run --name rust -d -p 10242:10242 mattgodbolt/gcc-explorer:rust)
$SUDO docker run --name gcc1204 ${CFG} -d -p 20480:20480 mattgodbolt/gcc-explorer:gcc1204
$SUDO docker run --name gcc ${CFG} --link gcc1204:gcc1204 -d -p 10240:10240 mattgodbolt/gcc-explorer:gcc
$SUDO docker run --name d ${CFG} -d -p 10241:10241 mattgodbolt/gcc-explorer:d
$SUDO docker run --name rust ${CFG} -d -p 10242:10242 mattgodbolt/gcc-explorer:rust

trap "$SUDO docker stop $GCC $D $RUST" SIGINT SIGTERM SIGPIPE
trap "$SUDO docker stop ${ALL}" SIGINT SIGTERM SIGPIPE

$SUDO docker run \
-p 80:80 \
-p ${EXTERNAL_PORT}:80 \
--name nginx \
--volumes-from gcc \
-v /var/log/nginx:/var/log/nginx \
-v /home/ubuntu:/var/www \
-v $(pwd)/nginx:/etc/nginx/sites-enabled \
-v /home/ubuntu:/var/www:ro \
-v $(pwd)/nginx:/etc/nginx/sites-enabled:ro \
--link gcc:gcc --link d:d --link rust:rust \
dockerfile/nginx
2 changes: 2 additions & 0 deletions site-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Sourced when running in development mode
export BRANCH=master
2 changes: 2 additions & 0 deletions site-prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Sourced when loaded in production
export BRANCH=release

0 comments on commit fbe08cc

Please sign in to comment.