Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dockerfiles and Docker instructions #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Vidminas
Copy link
Contributor

The main https://github.com/CommunitySolidServer/CommunitySolidServer repo has instructions for running with Docker. To make integrating the recipes easier into existing Docker workflows, I've added a minimal Dockerfile for each of the extensions and instructions how to use them.

I've only recently started using Docker, so a review of the Dockerfiles by someone with more experience might be helpful

@joachimvh
Copy link
Member

Assigning @Falx to this as he handles everything docker related in the CSS repo. The docker files are missing a trailing newline though.

Copy link

@Falx Falx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the Dockerfiles of the CSS were specifically designed to be used as a base to build plugins on top of in a new Dockerfile. Instead I would use a simplified approach to build from scratch (as you essentially also do when building in nodejs):

# Build stage
FROM node:lts-alpine

# Set current working directory
WORKDIR /community-server

# Copy the package.json and package-lock.json files and any required docker context files (like a src folder)
COPY package*.json .

# Container config & data dir for volume sharing
# Defaults to filestorage with /data directory (passed through CMD below)
RUN mkdir /config /data
# Copy all config files to /config
COPY config* /config

# Install and build the Solid community server
RUN npm ci --unsafe-perm --omit=dev

# Remove src folder if present (not needed in container once built)
RUN rm -rf /community-server/src

# Informs Docker that the container listens on the specified network port at runtime
EXPOSE 3000

# Set command run by the container
ENTRYPOINT [ "npx", "community-solid-server", "-c", "/config/config-penny.json" ]

# By default run in filemode (overriden if passing alternative arguments or env vars)
ENV CSS_CONFIG=/config/config-penny.json
ENV CSS_ROOT_FILE_PATH=/data

This can be built in the penny folder docker build -t mypennyexample:latest . and then be used to run with docker run --rm --name test -p 3000:3000 -v C:\Users\user\mydata:/data -it mypennyexample:latest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants