diff --git a/.elasticbeanstalk/config.yml b/.elasticbeanstalk/config.yml new file mode 100644 index 0000000000000000000000000000000000000000..9c857cdf7a2d531d0bdbe19b6208ac294796c37e --- /dev/null +++ b/.elasticbeanstalk/config.yml @@ -0,0 +1,12 @@ +branch-defaults: + $GIT_BRANCH: + environment: $EB_ENV +global: + application_name: $EB_APP + default_ec2_keyname: EastCoastBPKey + default_platform: 64bit Amazon Linux 2015.09 v2.0.8 running Docker 1.9.1 + default_region: us-east-1 + profile: null + sc: git +deploy: + artifact: deployment.zip \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..e14c39eff418ab5acdf47b72165fb839de2cf3e8 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +FROM ubuntu + +ENV CODEROOT=/home/docker/code + +# Log enironment variables. +ENV NGINXERR=/var/log/nginx.err.log +ENV NGINXREQ=/var/log/nginx.req.log + +# Custom environment variables. These change from project to project. +ARG DOMAIN +ENV DOMAIN=${DOMAIN} + +# Install dependencies. +RUN \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + nginx supervisor \ + build-essential git && \ + rm -rf /var/lib/apt/lists/* + +# Put the code somewhere. +ADD . $CODEROOT/ + +# Create the www user. +RUN useradd -ms /bin/bash www + +# Create the log files. +RUN touch $NGINXERR && touch $NGINXREQ + +# Copy the configuration files, inserting environment variables along the way. +RUN \ + replace_vars() { \ + echo "Copying environment variables from $1 to $2."; \ + sed -e "s/\$DOMAIN/$DOMAIN/g" \ + -e "s@\$CODEROOT@$CODEROOT@g" \ + -e "s@\$NGINXERR@$NGINXERR@g" \ + -e "s@\$NGINXREQ@$NGINXREQ@g" $1 > $2; \ + }; \ + replace_vars $CODEROOT/config/nginx.conf /etc/nginx/nginx.conf && \ + replace_vars $CODEROOT/config/supervisor.conf /etc/supervisor/conf.d/supervisor.conf + +EXPOSE 80 +CMD ["supervisord", "-n"] \ No newline at end of file diff --git a/Dockerrun.aws.json b/Dockerrun.aws.json new file mode 100644 index 0000000000000000000000000000000000000000..f62e9284951fc105ce96c9b5ad1036331b116acf --- /dev/null +++ b/Dockerrun.aws.json @@ -0,0 +1,16 @@ +{ + "AWSEBDockerrunVersion": "1", + "Authentication": { + "Bucket": "dockerauth.blocpower.org", + "Key": "$DOCKER_REPO.json" + }, + "Image": { + "Name": "blocp/$DOCKER_REPO" + }, + "Ports": [ + { + "HostPort": "80", + "ContainerPort": "80" + } + ] +} \ No newline at end of file diff --git a/config/nginx.conf b/config/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..e733b12df3bd645dbc23213c7f027a9962413290 --- /dev/null +++ b/config/nginx.conf @@ -0,0 +1,29 @@ +daemon off; +user www; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + gzip on; + charset utf-8; + client_max_body_size 10M; + + access_log $NGINXREQ; + error_log $NGINXERR; + + server { + listen 80; + listen [::]:80; + server_name $DOMAIN www.$DOMAIN; + location / { + root $CODEROOT/build; + try_files $uri$args $uri$args/ $uri/ /index.html =404; + } + } +} \ No newline at end of file diff --git a/config/supervisor.conf b/config/supervisor.conf new file mode 100644 index 0000000000000000000000000000000000000000..22f88b5f1f83015f64de681fcafb2cf3945bf32f --- /dev/null +++ b/config/supervisor.conf @@ -0,0 +1,2 @@ +[program:nginx] +command = /usr/sbin/nginx \ No newline at end of file