Skip to content

Commit 6fa06c2

Browse files
committed
rejig
1 parent b411a74 commit 6fa06c2

12 files changed

+107
-12
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.swp
2+
node_modules/

Dockerfile

+9-11
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
1-
from debian:jessie
1+
FROM debian:jessie
22

3-
run set -uex; \
3+
RUN set -uex; \
44
apt-get update -y; \
55
apt-get install apt-cacher-ng -y; \
66
ln -sf /dev/stdout /var/log/apt-cacher-ng/apt-cacher.log; \
77
ln -sf /dev/stderr /var/log/apt-cacher-ng/apt-cacher.err; \
88
apt-get clean all;
99

10-
copy acng.conf /etc/apt-cacher-ng/acng.conf
11-
copy mirrors_alpine /etc/apt-cacher-ng/
10+
COPY files/acng.conf files/mirrors_alpine /etc/apt-cacher-ng/
1211

13-
label org.label-schema.name = "deployable/apt-cacher-ng" \
14-
org.label-schema.version="1.0.0" \
12+
LABEL org.label-schema.name = "deployable/apt-cacher-ng" \
13+
org.label-schema.version="1.2.0" \
1514
org.label-schema.vendor="Deployable" \
1615
org.label-schema.docker.cmd="docker run --restart always -d -v apt-cacher-ng-vol:/var/cache/apt-cacher-ng:rw -p 3142:3142 deployable/apt-cacher-ng \
1716
org.label-schema.url="https://github.com/deployable/docker-apt-cacher-ng" \
1817
org.label-schema.vcs-url="https://github.com/deployable/docker-apt-cacher-ng.git" \
19-
org.label-schema.vcs-ref = "b4cac33cff2491440c3c010aabc885387ade425f" \
2018
org.label-schema.schema-version="1.0"
2119
22-
expose 3142
23-
volume ["/var/cache/apt-cacher-ng"]
20+
EXPOSE 3142
21+
VOLUME ["/var/cache/apt-cacher-ng"]
2422
25-
entrypoint ["/usr/sbin/apt-cacher-ng"]
26-
cmd ["-c","/etc/apt-cacher-ng"]
23+
ENTRYPOINT ["/usr/sbin/apt-cacher-ng"]
24+
CMD ["-c","/etc/apt-cacher-ng"]
2725

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Apt-Cacher NG is a caching proxy for linux distribution packages, primarily Debian. https://www.unix-ag.uni-kl.de/~bloch/acng/
44

5-
The container config adds support for alpine packages.
5+
The containers apt-cacher-ng config adds support for Alpine Linux packages from http://dl-cdn.alpinelinux.org.
66

77
## Run
88

@@ -29,3 +29,7 @@ Rebuild and run
2929

3030
`./make.sh rebuild`
3131

32+
## About
33+
34+
Matt Hoyle - [email protected]
35+

acng.conf files/acng.conf

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

package.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "docker-apt-cacher-ng",
3+
"version": "1.0.0",
4+
"description": "tests for docker ",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "mocha"
8+
},
9+
"repository": {
10+
"type": "git",
11+
"url": "git+https://github.com/deployable/docker-apt-cacher-ng.git"
12+
},
13+
"keywords": [
14+
"docker",
15+
"apt-cacher-ng",
16+
"proxy",
17+
"cache",
18+
"package"
19+
],
20+
"author": "Matt Hoyle",
21+
"license": "ISC",
22+
"bugs": {
23+
"url": "https://github.com/deployable/docker-apt-cacher-ng/issues"
24+
},
25+
"homepage": "https://github.com/deployable/docker-apt-cacher-ng#readme",
26+
"devDependencies": {
27+
"chai": "^3.5.0",
28+
"cheerio": "^0.22.0",
29+
"coffeescript": "^1.12.4",
30+
"mocha": "^3.2.0"
31+
}
32+
}

test/fixture/mocha_setup.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
global.chai = require('chai')
2+
global.expect = require('chai').expect
3+
4+
process.env.NODE_ENV = 'test'
5+

test/functional_aptcacherng.coffee

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Promise = require('bluebird')
2+
needle = Promise.promisifyAll(require('needle'))
3+
cheerio = require('cheerio')
4+
debug = require('debug') 'dply:test:func:aptcacherng'
5+
6+
request_options =
7+
proxy: 'http://127.0.0.1:3142'
8+
9+
getCacherPage = ( repo_url )->
10+
needle.getAsync repo_url, request_options
11+
12+
13+
describe 'cache requests', ->
14+
15+
16+
it 'responds with an apt error for a directory', ->
17+
getCacherPage 'http://dl-cdn.alpinelinux.org/alpine/v3.5/', request_options
18+
.then (res) ->
19+
expect( res ).to.be.ok
20+
$ = cheerio.load(res.body)
21+
expect( $('body').text() ).to.match /Apt-Cacher NG/
22+
23+
# curl 'http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz' -H 'Host: dl-cdn.alpinelinux.org' -H 'User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:45.0) Gecko/20100101 Firefox/45.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/' -H 'Connection: keep-alive'
24+
25+
describe 'pulling a file', ->
26+
27+
this.timeout(5000)
28+
file_request_options = request_options
29+
res = null
30+
31+
before ->
32+
res = getCacherPage 'http://dl-cdn.alpinelinux.org/alpine/v3.5/main/x86_64/APKINDEX.tar.gz', file_request_options
33+
34+
it 'sould return a response', ->
35+
expect( res ).to.be.ok
36+
37+
it 'sould return a buffer for the body', ->
38+
expect( res.body ).to.be.an.instanceof Buffer
39+
40+
it 'should have headers', ->
41+
expect( res.headers ).to.be.ok
42+
43+
it 'should have a bzip content type', ->
44+
expect( res.headers['content-type'] ).to.equal 'application/x-gzip'
45+
46+
it 'should have a statusCode of 200', ->
47+
expect( res.statusCode ).to.equal 200
48+

test/mocha.opts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
--compilers coffee:coffeescript/register
2+
--require test/fixture/mocha_setup
3+
--reporter spec
4+
--ui bdd
5+

0 commit comments

Comments
 (0)