File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Simply here to ensure the cache folder is created
Original file line number Diff line number Diff line change 1+ FROM nginx
2+ ADD .empty /var/cache/npm/data
3+ ADD nginx.conf /etc/nginx.conf
4+
Original file line number Diff line number Diff line change 1+ # docker-npm-cache
2+ Docker container that implements a very basic npm cache via nginx
3+ as outlined by [ this post from Yammer] [ 1 ] .
4+
5+ [ 1 ] : http://eng.yammer.com/a-private-npm-cache/
Original file line number Diff line number Diff line change 1+ #user nobody;
2+ worker_processes 1;
3+
4+ #error_log logs/error.log;
5+ #error_log logs/error.log notice;
6+ #error_log logs/error.log info;
7+
8+ #pid logs/nginx.pid;
9+
10+
11+ events {
12+ worker_connections 1024 ;
13+ }
14+
15+
16+ http {
17+ include mime.types ;
18+ default_type application/octet-stream ;
19+
20+ #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
21+ # '$status $body_bytes_sent "$http_referer" '
22+ # '"$http_user_agent" "$http_x_forwarded_for"';
23+
24+ #access_log logs/access.log main;
25+
26+ sendfile on;
27+ #tcp_nopush on;
28+
29+ #keepalive_timeout 0;
30+ keepalive_timeout 65 ;
31+
32+ #gzip on;
33+
34+ proxy_cache_path /var/cache/npm/data levels=1:2 keys_zone=npm:20m max_size=1000m inactive=3d ;
35+ proxy_temp_path /var/cache/npm/tmp;
36+
37+ server {
38+ listen 80 ;
39+ server_name localhost;
40+
41+ #charset koi8-r;
42+
43+ #access_log logs/host.access.log main;
44+
45+ location / {
46+ index index .html index .htm;
47+
48+ proxy_pass https://registry.npmjs.org/;
49+ proxy_cache npm;
50+ proxy_cache_valid 200 302 3d ;
51+ proxy_cache_valid 404 1m ;
52+ sub_filter 'registry.npmjs.org' '192.168.59.103' ;
53+ sub_filter_once off;
54+ sub_filter_types application/json;
55+ }
56+
57+ #error_page 404 /404.html;
58+
59+ # redirect server error pages to the static page /50x.html
60+ #
61+ error_page 500 502 503 504 /50x .html;
62+ location = /50x .html {
63+ root html;
64+ }
65+
66+ }
67+
68+ }
69+
70+ # stay in the foreground so Docker has a process to track
71+ daemon off;
You can’t perform that action at this time.
0 commit comments