Skip to content

Commit 14e1f65

Browse files
authored
enh(build) slimmer Docker image and add .dockerignore (#2719)
* use node:12-slim base image + minor cleanups * do not copy unnecessary things into the Docker images - The use of `node:12-slim` as a base image dramatically decreases Docker image size (from 1.1 GB to 342 MB).
1 parent f5e24b9 commit 14e1f65

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

.dockerignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.DS_Store
2+
build
3+
docs/_build
4+
__pycache__
5+
*.swp
6+
node_modules
7+
.project
8+
9+
# editors
10+
.idea/
11+
.vscode/
12+
.Rproj.user
13+
14+
# misc
15+
/work

Dockerfile

+17-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
1-
FROM node:12
2-
# docker build -t highlight-js .
3-
RUN apt-get update && apt-get install -y nginx
1+
# Dockerfile for highlight.js
2+
#
3+
# Build image:
4+
# docker build -t highlight-js .
5+
#
6+
# Run container:
7+
# docker run --rm -it --publish 8080:80 highlight-js
8+
#
9+
# And open a browser to http://localhost:8080
10+
11+
FROM node:12-slim
12+
RUN apt-get update -qq \
13+
&& apt-get install --yes --no-install-recommends \
14+
nginx \
15+
&& rm -rf /var/lib/apt/lists/*
416
WORKDIR /var/www/html
5-
COPY ./package*.json /var/www/html/
17+
COPY package*.json /var/www/html/
618
RUN npm install
7-
COPY . /var/www/html
19+
COPY . .
820
RUN node tools/build.js :common
921
EXPOSE 80
1022
CMD ["nginx", "-g", "daemon off;"]

0 commit comments

Comments
 (0)