-
Notifications
You must be signed in to change notification settings - Fork 216
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
Docker support #223
Comments
Hey @aliuq thanks for this. We may support docker eventually but it's not a priority at this time. Are you interested in docker for running this locally, developing against the repo, or are you trying to host srcbook? |
@benjreinhart Hi, I tried a rebuild and during the process I found that the On the contrary, building the container with the official npm package is much easier, the only problem is that some extra files are bundled with the container, resulting in a large image size. I've built an image FROM node:22.7.0-alpine3.20 AS builder
WORKDIR /app
RUN yarn add srcbook && \
mv node_modules/srcbook . && \
rm node_modules yarn.lock package.json -rf && \
mv srcbook/* . && \
rm node_modules -rf && \
yarn install --prod && \
find ./node_modules -type f \( -name "*.d.ts" -o -name "*.log" -o -name "*.bak" -o -name "DS_Store" -o -name "LICENSE" -o -name "*.d.mts" -o -name "*.txt" \) -delete
FROM node:22.7.0-alpine3.20 AS runner
WORKDIR /app
COPY --from=builder /app .
CMD [ "node", "bin/cli.mjs", "start" ]
EXPOSE 2150
VOLUME /root/.srcbook
VOLUME /root/.npm Usage # Start
docker run -p 2150:2150 -v $PWD/srcbookData:/root/.srcbook --name srcbook aliuq/srcbook
# Stop
docker rm srcbook -f
# Exec
docker exec -it srcbook /bin/sh It would be nice to start building from web and api! |
srcbook is a great project
The current
api
andshared
build methods will cause theimage
size to be too large, it contains some devDependencies for start works, I don’t know if there is any reason for this design.Some thoughts on containers, there should be two images, one
web
and oneapi
. After the web image is built, usenginx/apache
to run it. After the api image is built, usenode
to run it.Useful library building tools,tsup and unbuild
The text was updated successfully, but these errors were encountered: