chore!: update docker scripts (#797)
BREAKING CHANGE: this new docker image no longer clones this repository. Some manual steps are required * chore!: update docker scripts * chore: fix paths in docker scripts * chore: add config docker compose
This commit is contained in:
+7
-25
@@ -1,8 +1,6 @@
|
||||
FROM node:alpine
|
||||
|
||||
# env vars
|
||||
ENV WORK_DIR="/srv/fosscord-server"
|
||||
ENV DEV_MODE=0
|
||||
ENV HTTP_PORT=3001
|
||||
ENV WS_PORT=3002
|
||||
ENV CDN_PORT=3003
|
||||
@@ -13,28 +11,12 @@ ENV ADMIN_PORT=3005
|
||||
EXPOSE ${HTTP_PORT}/tcp ${WS_PORT}/tcp ${CDN_PORT}/tcp ${RTC_PORT}/tcp ${ADMIN_PORT}/tcp
|
||||
|
||||
# install required apps
|
||||
RUN apk add --no-cache --update git python2 py-pip make build-base
|
||||
RUN apk add --no-cache --update git python3 py-pip make build-base
|
||||
RUN ln -s /usr/bin/python3 /usr/bin/python
|
||||
|
||||
# optionl: packages for debugging/development
|
||||
RUN apk add --no-cache sqlite
|
||||
# Run as non-root user
|
||||
# RUN adduser -D fosscord
|
||||
# USER fosscord
|
||||
|
||||
# download fosscord-server
|
||||
WORKDIR $WORK_DIR/src
|
||||
RUN git clone https://github.com/fosscord/fosscord-server.git .
|
||||
|
||||
# setup and run
|
||||
WORKDIR $WORK_DIR/src/bundle
|
||||
RUN npm run setup
|
||||
RUN npm install @yukikaze-bot/erlpack
|
||||
# RUN npm install mysql --save
|
||||
|
||||
# create update script
|
||||
RUN printf '#!/bin/sh\n\ngit -C $WORK_DIR/src/ checkout master\ngit -C $WORK_DIR/src/ reset --hard HEAD\ngit -C $WORK_DIR/src/ pull\ncd $WORK_DIR/src/bundle/\nnpm run setup\n' > $WORK_DIR/update.sh
|
||||
RUN chmod +x $WORK_DIR/update.sh
|
||||
|
||||
# configure entrypoint file
|
||||
RUN printf '#!/bin/sh\n\nDEV_MODE=${DEV_MODE:-0}\n\nif [ "$DEV_MODE" -eq 1 ]; then\n tail -f /dev/null\nelse\n cd $WORK_DIR/src/bundle/\n npm run start:bundle\nfi\n' > $WORK_DIR/entrypoint.sh
|
||||
RUN chmod +x $WORK_DIR/entrypoint.sh
|
||||
|
||||
WORKDIR $WORK_DIR
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
WORKDIR /srv/fosscord-server/bundle
|
||||
ENTRYPOINT ["npm", "run", "start:bundle"]
|
||||
Reference in New Issue
Block a user