Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.git
node_modules
*.md
test
.git*
cache
21 changes: 21 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM mhart/alpine-node

MAINTAINER Dmitry Shirokov <[email protected]>

ADD package.json /tmp/package.json

RUN cd /tmp && \
npm install --production && \
mkdir -p /opt/npm-proxy-cache && \
cp -a /tmp/node_modules /opt/npm-proxy-cache && \
mkdir -p /opt/npm-proxy-cache/cache

VOLUME /opt/npm-proxy-cache/cache

WORKDIR /opt/npm-proxy-cache
ADD . /opt/npm-proxy-cache

# Expose API port
EXPOSE 8080

ENTRYPOINT ["node", "/opt/npm-proxy-cache/bin/npm-proxy-cache"]
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@ more work and maintenance.


## Installation

### NPM
npm install npm-proxy-cache -g

### Docker
The docker image of this repository is not hosted on Docker Hub (yet)

To run npm-proxy-cache as a Docker container, you need to build the image first:

`docker build -t npm-proxy-cache .`

After building the image successfully, you can run the Docker container. To pass parameters, simply append them to the `docker run` command, like so:

`docker run -t npm-proxy-cache --port 8080 --host 0.0.0.0 --expired`

## Usage

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


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

Well, for some reason npm cache works not as expected and cache hits are low. Additionally,
Expand Down
6 changes: 6 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
npmproxycache:
build: .
ports:
- "8080:8080"
# You can pass parameters here
command: "--host 0.0.0.0 --port 8080 --verbose --expired"