Skip to content

Commit 4de7252

Browse files
committed
Initial Commit
0 parents  commit 4de7252

File tree

10 files changed

+195
-0
lines changed

10 files changed

+195
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

.travis.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
sudo: required
3+
services:
4+
- docker
5+
6+
language: ruby
7+
rvm:
8+
- 2.4
9+
cache: bundler
10+
11+
before_install:
12+
- docker pull hadolint/hadolint
13+
14+
script:
15+
- docker run --rm -i hadolint/hadolint < Dockerfile
16+
- bundle exec rspec
17+
18+
after_success:
19+
- docker images
20+
21+
notifications:
22+
email: false

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM jwilder/nginx-proxy:0.7.0
2+
3+
LABEL name="jasonheecs/nginx-proxy"
4+
LABEL version="1.0.0"
5+
LABEL maintainer="hello@jasonhee.com"
6+
7+
COPY conf /etc/nginx/conf.d
8+
9+
ENV DOCKER_HOST unix:///tmp/docker.sock
10+
11+
VOLUME ["/etc/nginx/certs", "/etc/nginx/dhparam"]
12+
13+
ENTRYPOINT ["/app/docker-entrypoint.sh"]
14+
CMD ["forego", "start", "-r"]

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'rspec'
4+
gem 'serverspec'
5+
gem 'docker-api'

Gemfile.lock

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
diff-lcs (1.3)
5+
docker-api (1.34.2)
6+
excon (>= 0.47.0)
7+
multi_json
8+
excon (0.62.0)
9+
multi_json (1.13.1)
10+
net-scp (1.2.1)
11+
net-ssh (>= 2.6.5)
12+
net-ssh (5.0.2)
13+
net-telnet (0.1.1)
14+
rspec (3.7.0)
15+
rspec-core (~> 3.7.0)
16+
rspec-expectations (~> 3.7.0)
17+
rspec-mocks (~> 3.7.0)
18+
rspec-core (3.7.1)
19+
rspec-support (~> 3.7.0)
20+
rspec-expectations (3.7.0)
21+
diff-lcs (>= 1.2.0, < 2.0)
22+
rspec-support (~> 3.7.0)
23+
rspec-its (1.2.0)
24+
rspec-core (>= 3.0.0)
25+
rspec-expectations (>= 3.0.0)
26+
rspec-mocks (3.7.0)
27+
diff-lcs (>= 1.2.0, < 2.0)
28+
rspec-support (~> 3.7.0)
29+
rspec-support (3.7.1)
30+
serverspec (2.41.3)
31+
multi_json
32+
rspec (~> 3.0)
33+
rspec-its
34+
specinfra (~> 2.72)
35+
sfl (2.3)
36+
specinfra (2.75.0)
37+
net-scp
38+
net-ssh (>= 2.7)
39+
net-telnet
40+
sfl
41+
42+
PLATFORMS
43+
ruby
44+
45+
DEPENDENCIES
46+
docker-api
47+
rspec
48+
serverspec
49+
50+
BUNDLED WITH
51+
1.16.2

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) Jason Hee
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Modified Docker Image for nginx-proxy
2+
3+
A modified docker image based on the [nginx-proxy](https://github.com/jwilder/nginx-proxy) docker image. Increased nginx upload limts and removed nginx server tokens.
4+
5+
## Usage
6+
7+
`docker pull jasonheecs/nginx-proxy:latest`
8+
9+
Sample `docker-compose` file:
10+
11+
```
12+
version: '2'
13+
services:
14+
nginx-proxy:
15+
image: jasonheecs/nginx-proxy
16+
ports:
17+
- "80:80"
18+
volumes:
19+
- /var/run/docker.sock:/tmp/docker.sock
20+
container_name: nginx-proxy
21+
```
22+
23+
## Testing
24+
Testing is done via Rspec and Hadolint
25+
26+
To run Rspec tests:
27+
```bash
28+
gem install bundler
29+
bundle install
30+
bundle exec rspec
31+
```
32+
33+
To run linting tests on the Dockerfile:
34+
```bash
35+
docker pull hadolint/hadolint
36+
docker run --rm -i hadolint/hadolint < Dockerfile
37+
```
38+
39+
Refer to the [travis.yml](.travis.yml) file and [Travis build logs][travis-link] for details on the automated tests and expected outputs.
40+
41+
## License
42+
MIT

conf/custom_proxy_settings.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
server_tokens off;
2+
client_max_body_size 10m;

spec/dockerfile_spec.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
require "serverspec"
2+
require "spec_helper"
3+
require "docker"
4+
5+
describe "Dockerfile" do
6+
let(:image) { Docker::Image.build_from_dir('./') }
7+
let(:container) { Docker::Container.create('Cmd' => ['ls'], 'Image' => image.id) }
8+
9+
before(:each) do
10+
image.tag(repo: 'jasonheecs/nginx-proxy', tag: 'latest')
11+
12+
set :os, family: :debian
13+
set :backend, :docker
14+
set :docker_image, image.id
15+
set :docker_container, container.id
16+
set :docker_container_create_options, { 'Entrypoint' => ['/bin/bash', '-s'] }
17+
end
18+
19+
it "should have the maintainer label" do
20+
expect(image.json["Config"]["Labels"].has_key?("maintainer"))
21+
end
22+
23+
describe package('nginx') do
24+
it { should be_installed }
25+
end
26+
27+
describe file('/etc/nginx/conf.d/custom_proxy_settings.conf') do
28+
it { should be_file }
29+
end
30+
end

spec/spec_helper.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require "docker"
2+
3+
set :backend, :exec
4+
5+
Dir[File.join(__dir__, 'support', '*.rb')].each { |file| require file }
6+
7+
Docker.options = { read_timeout: 800, write_timeout: 800 }

0 commit comments

Comments
 (0)