Skip to content

Commit d3543dc

Browse files
committed
First commit
0 parents  commit d3543dc

File tree

5 files changed

+142
-0
lines changed

5 files changed

+142
-0
lines changed

Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM phusion/baseimage:0.9.19
2+
MAINTAINER Joshua Noble <[email protected]>
3+
4+
RUN locale-gen en_US.UTF-8
5+
ENV LANG en_US.UTF-8
6+
ENV LC_ALL en_US.UTF-8
7+
ENV DEBIAN_FRONTEND noninteractive
8+
ENV HOME /root
9+
10+
CMD ["/sbin/my_init"]
11+
12+
RUN add-apt-repository ppa:nginx/stable && \
13+
apt-get update && \
14+
apt-get install -y curl git build-essential && \
15+
cd /usr/src && \
16+
apt-get build-dep -y nginx && \
17+
apt-get source nginx
18+
19+
RUN cd /usr/src/nginx* && \
20+
git clone https://github.com/openresty/set-misc-nginx-module.git debian/modules/set-misc-nginx-module && \
21+
git clone https://github.com/simpl/ngx_devel_kit.git debian/modules/ngx_devel_kit && \
22+
git clone -b AuthV2 https://github.com/acejam/ngx_aws_auth.git debian/modules/ngx_aws_auth && \
23+
sed -i -e 's/--add-module=\$(MODULESDIR)\/nginx-development-kit \\/--add-module=\$(MODULESDIR)\/ngx_devel_kit \\\n \t\t\t--add-module=\$(MODULESDIR)\/set-misc-nginx-module \\\n \t\t\t--add-module=\$(MODULESDIR)\/ngx_aws_auth \\/g' debian/rules && \
24+
dpkg-buildpackage -us -uc && \
25+
dpkg -i ../nginx-common*.deb && \
26+
dpkg -i ../nginx-extras_*.deb
27+
28+
RUN mkdir -p /etc/service/nginx
29+
ADD nginx.sh /etc/service/nginx/run
30+
ADD default.conf /etc/nginx/sites-available/default
31+
ADD nginx.conf /etc/nginx/nginx.conf
32+
33+
EXPOSE 80
34+
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# nginx-s3-proxy
2+
3+
A Docker container for a custom version of nginx
4+
<!--
5+
6+
7+
[![Build Status](https://travis-ci.org/acejam/docker-bitmessage.svg?branch=basic-setup)](https://travis-ci.org/acejam/docker-bitmessage)
8+
[![Docker Stars](https://img.shields.io/docker/stars/acejam/bitmessage.svg?maxAge=2592000)](https://hub.docker.com/r/acejam/bitmessage)
9+
[![Docker Pulls](https://img.shields.io/docker/pulls/acejam/bitmessage.svg?maxAge=2592000)](https://hub.docker.com/r/acejam/bitmessage)
10+
11+
A Docker container for Bitmessage
12+
13+
## Quick Start
14+
15+
docker run -d --name bitmessage --restart=always -v /data/bitmessage:/root/.config/PyBitmessage -p 8444:8444 -p 8442:8442 acejam/bitmessage:latest
16+
17+
## Config options
18+
19+
This container includes support for various Bitmessage configuration values. These values can be set when calling `docker run` through the use of environment variables.
20+
21+
The following values are configurable:
22+
* `RPC_USER`
23+
* `RPC_PASS`
24+
* `RPC_INTERFACE`
25+
26+
For example, to run the container with the username "DevUser" and a password of "P@ssw0rd123", you can run the following:
27+
28+
docker run -d -e RPC_USER="DevUser" -e RPC_PASS="P@ssw0rd123" acejam/bitmessage:latest
29+
30+
## Data persistence
31+
32+
Coming soon! -->

default.conf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
location / {
6+
set_by_lua $s3_bucket 'return os.getenv("S3_BUCKET")';
7+
set_by_lua $aws_access_key 'return os.getenv("AWS_ACCESS_KEY")';
8+
set_by_lua $aws_secret_key 'return os.getenv("AWS_SECRET_KEY")';
9+
10+
s3_bucket $s3_bucket;
11+
aws_access_key $aws_access_key;
12+
aws_secret_key $aws_secret_key;
13+
14+
resolver 8.8.8.8;
15+
proxy_pass https://$s3_bucket.s3.amazonaws.com;
16+
proxy_set_header Authorization $s3_auth_token;
17+
proxy_set_header x-amz-date $aws_date;
18+
19+
proxy_cache s3cache;
20+
proxy_cache_valid 200 302 24h;
21+
proxy_cache_valid 404 1m;
22+
proxy_cache_convert_head on;
23+
add_header X-Proxy-Cache $upstream_cache_status;
24+
}
25+
}

nginx.conf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
user www-data;
2+
worker_processes auto;
3+
pid /run/nginx.pid;
4+
daemon off;
5+
6+
env S3_BUCKET;
7+
env AWS_ACCESS_KEY;
8+
env AWS_SECRET_KEY;
9+
10+
events {
11+
worker_connections 768;
12+
}
13+
14+
http {
15+
sendfile on;
16+
tcp_nopush on;
17+
tcp_nodelay on;
18+
keepalive_timeout 65;
19+
types_hash_max_size 2048;
20+
server_names_hash_bucket_size 64;
21+
22+
include /etc/nginx/mime.types;
23+
default_type application/octet-stream;
24+
25+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
26+
ssl_prefer_server_ciphers on;
27+
28+
access_log /dev/stdout;
29+
error_log /dev/stderr error;
30+
31+
gzip on;
32+
gzip_disable "msie6";
33+
gzip_http_version 1.1;
34+
gzip_types
35+
text/css
36+
text/javascript
37+
text/xml
38+
text/plain
39+
application/javascript
40+
application/x-javascript
41+
application/json;
42+
43+
proxy_cache_lock on;
44+
proxy_cache_lock_timeout 5s;
45+
proxy_cache_path /etc/nginx/cache levels=1:2 keys_zone=s3cache:10m max_size=30g;
46+
47+
include /etc/nginx/conf.d/*.conf;
48+
include /etc/nginx/sites-enabled/*;
49+
}

nginx.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
nginx

0 commit comments

Comments
 (0)