Skip to content

Commit e36e8de

Browse files
authored
Merge pull request #54 from FrankZZ/feature/dockerfile
Feature/dockerfile
2 parents 707347d + 73966e9 commit e36e8de

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
node_modules
3+
*.md
4+
test
5+
.git*
6+
cache

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM mhart/alpine-node
2+
3+
MAINTAINER Dmitry Shirokov <[email protected]>
4+
5+
ADD package.json /tmp/package.json
6+
7+
RUN cd /tmp && \
8+
npm install --production && \
9+
mkdir -p /opt/npm-proxy-cache && \
10+
cp -a /tmp/node_modules /opt/npm-proxy-cache && \
11+
mkdir -p /opt/npm-proxy-cache/cache
12+
13+
VOLUME /opt/npm-proxy-cache/cache
14+
15+
WORKDIR /opt/npm-proxy-cache
16+
ADD . /opt/npm-proxy-cache
17+
18+
# Expose API port
19+
EXPOSE 8080
20+
21+
ENTRYPOINT ["node", "/opt/npm-proxy-cache/bin/npm-proxy-cache"]

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,19 @@ more work and maintenance.
1010

1111

1212
## Installation
13-
13+
### NPM
1414
npm install npm-proxy-cache -g
1515

16+
### Docker
17+
The docker image of this repository is not hosted on Docker Hub (yet)
18+
19+
To run npm-proxy-cache as a Docker container, you need to build the image first:
20+
21+
`docker build -t npm-proxy-cache .`
22+
23+
After building the image successfully, you can run the Docker container. To pass parameters, simply append them to the `docker run` command, like so:
24+
25+
`docker run -t npm-proxy-cache --port 8080 --host 0.0.0.0 --expired`
1626

1727
## Usage
1828

@@ -56,7 +66,6 @@ overriden using command line options:
5666
-m, --internal-port HTTPs port to use for internal proxying "MITM" server (necessary for running on Windows systems)
5767
--help This help
5868

59-
6069
## Why can't I use the built-in npm cache?
6170

6271
Well, for some reason npm cache works not as expected and cache hits are low. Additionally,

docker-compose.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
npmproxycache:
2+
build: .
3+
ports:
4+
- "8080:8080"
5+
# You can pass parameters here
6+
command: "--host 0.0.0.0 --port 8080 --verbose --expired"

0 commit comments

Comments
 (0)