a5d5e446c7
Problem: The Docker example was using Alpine with the Tini dependency and some neat custom stuff, but it wasn't super clear to understand everything that was going on. It was also slow because lots of stuff was compiling from source. Solution: Replace neat custom stuff with boring defaults for clarity and much faster builds.
26 lines
656 B
Docker
26 lines
656 B
Docker
FROM node:lts
|
|
|
|
# Ensure that the ~/.ssb directory is persistent and owned by the 'node' user.
|
|
RUN mkdir /home/node/.ssb && chown node:node /home/node/.ssb
|
|
VOLUME /home/node/.ssb
|
|
|
|
# Don't run as root.
|
|
USER node
|
|
|
|
# Create app directory and use it.
|
|
RUN mkdir /home/node/app
|
|
WORKDIR /home/node/app
|
|
|
|
# Add dependency metadata and install dependencies.
|
|
ADD package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Add the rest of the source code.
|
|
ADD ./ ./
|
|
|
|
# Expose ports for Oasis and SSB replication.
|
|
EXPOSE 3000 8008
|
|
|
|
# Listen on the container's public interfaces but allow 'localhost' connections.
|
|
CMD ["node", ".", "--host", "0.0.0.0", "--allow-host", "localhost"]
|