Skip to content

Commit 562b253

Browse files
authored
Merge pull request #241 from consideRatio/docker-image-from-package-lock
Docker image: use package-lock.json and only include relevant parts
2 parents b6b296e + c4cb63d commit 562b253

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

.dockerignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Ignore everything...
2+
*
3+
# ... except:
4+
!bin/
5+
!lib/
6+
!chp-docker-entrypoint
7+
!index.js
8+
!package*.json
9+
!LICENSE

Dockerfile

+7-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ LABEL maintainer="Jupyter Project <[email protected]>"
66
# Useful tools for debugging
77
RUN apk add --no-cache jq curl
88

9+
# Copy relevant (see .dockerignore)
910
RUN mkdir -p /srv/configurable-http-proxy
10-
COPY . /srv/configurable-http-proxy
11+
COPY . /srv/configurable-http-proxy/
1112
WORKDIR /srv/configurable-http-proxy
1213

13-
# Install configurable-http-proxy, then automatically install compatible updates
14-
# to vulnerable dependencies, and finally uninstall npm which isn't needed.
15-
RUN npm install -g --production \
16-
&& npm audit fix \
14+
# Install configurable-http-proxy according to package-lock.json (ci) without
15+
# devDepdendencies (--production), then uninstall npm which isn't needed.
16+
RUN npm ci --production \
1717
&& npm uninstall -g npm
1818

1919
# Switch from the root user to the nobody user
@@ -24,4 +24,6 @@ USER 65534
2424
EXPOSE 8000
2525
EXPOSE 8001
2626

27+
# Put configurable-http-proxy on path for chp-docker-entrypoint
28+
ENV PATH=/srv/configurable-http-proxy/bin:$PATH
2729
ENTRYPOINT ["/srv/configurable-http-proxy/chp-docker-entrypoint"]

0 commit comments

Comments
 (0)