Skip to content

Commit

Permalink
docker: build from the local working directory
Browse files Browse the repository at this point in the history
With this change, the Dockerfile builds the Docker image from the code
checked out in the local filesystem, instead of downloading a revision
from git.

Implements ether#3657
  • Loading branch information
pierreprinetti committed Nov 8, 2019
1 parent c008ee3 commit dc15f4a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 39 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.hg
settings.json
src/node_modules
26 changes: 3 additions & 23 deletions docker/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
# https://github.com/ether/etherpad-lite
#
# Author: muxator
#
# Version 0.1

FROM node:10-buster-slim
LABEL maintainer="Etherpad team, https://github.com/ether/etherpad-lite"

# git hash of the version to be built.
# If not given, build the latest development version.
ARG ETHERPAD_VERSION=develop

# plugins to install while building the container. By default no plugins are
# installed.
# If given a value, it has to be a space-separated, quoted list of plugin names.
Expand All @@ -25,24 +19,10 @@ ARG ETHERPAD_PLUGINS=
# this can be done with build args (and is mandatory to build ARM version)
ENV NODE_ENV=development

# grab the ETHERPAD_VERSION tarball from github (no need to clone the whole
# repository)
RUN echo "Getting version: ${ETHERPAD_VERSION}" && \
curl \
--location \
--fail \
--silent \
--show-error \
--output /opt/etherpad-lite.tar.gz \
https://github.com/ether/etherpad-lite/archive/"${ETHERPAD_VERSION}".tar.gz && \
mkdir /opt/etherpad-lite && \
tar xf /opt/etherpad-lite.tar.gz \
--directory /opt/etherpad-lite \
--strip-components=1 && \
rm /opt/etherpad-lite.tar.gz

WORKDIR /opt/etherpad-lite

COPY ./ ./

# install node dependencies for Etherpad
RUN bin/installDeps.sh && \
rm -rf ~/.npm/_cacache
Expand All @@ -54,7 +34,7 @@ RUN bin/installDeps.sh && \
RUN for PLUGIN_NAME in ${ETHERPAD_PLUGINS}; do npm install "${PLUGIN_NAME}"; done

# Copy the configuration file.
COPY ./settings.json /opt/etherpad-lite/
COPY ./docker/settings.json /opt/etherpad-lite/settings.json

# Follow the principle of least privilege: run as unprivileged user.
#
Expand Down
17 changes: 1 addition & 16 deletions doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,11 @@ Some plugins will need personalized settings in the `settings.json` file. Just r

### Examples

Build the latest development version:
Build a Docker image from the currently checked-out code:
```bash
docker build --tag <YOUR_USERNAME>/etherpad .
```

Build the latest stable version:
```bash
docker build --build-arg ETHERPAD_VERSION=master --build-arg NODE_ENV=production --tag <YOUR_USERNAME>/etherpad .
```

Build a specific tagged version:
```bash
docker build --build-arg ETHERPAD_VERSION=1.7.5 --build-arg NODE_ENV=production --tag <YOUR_USERNAME>/etherpad .
```

Build a specific git hash:
```bash
docker build --build-arg ETHERPAD_VERSION=4c45ac3cb1ae --tag <YOUR_USERNAME>/etherpad .
```

Include two plugins in the container:
```bash
docker build --build-arg ETHERPAD_PLUGINS="ep_codepad ep_author_neat" --tag <YOUR_USERNAME>/etherpad .
Expand Down

0 comments on commit dc15f4a

Please sign in to comment.