1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-22 02:12:40 +01:00

Start of docker refactor

This commit is contained in:
TheArcaneBrony 2022-09-07 08:53:13 +02:00
parent 58111e9df4
commit 4e393a7bbe
No known key found for this signature in database
GPG Key ID: 32FC5AAADAD75A22
7 changed files with 16 additions and 9 deletions

View File

@ -3,7 +3,7 @@ name: docker-publish-api
on: on:
push: push:
paths: paths:
- "api/**" - "src/api/**"
jobs: jobs:
docker-api: docker-api:

View File

@ -3,7 +3,7 @@ name: docker-publish-cdn
on: on:
push: push:
paths: paths:
- "cdn/**" - "src/cdn/**"
jobs: jobs:
docker-cdn: docker-cdn:

View File

@ -3,7 +3,7 @@ name: docker-publish-gw
on: on:
push: push:
paths: paths:
- "gateway/**" - "src/gateway/**"
jobs: jobs:
docker-gw: docker-gw:

View File

@ -6,17 +6,21 @@ ENV WS_PORT=3002
ENV CDN_PORT=3003 ENV CDN_PORT=3003
ENV RTC_PORT=3004 ENV RTC_PORT=3004
ENV ADMIN_PORT=3005 ENV ADMIN_PORT=3005
ENV THREADS=1
# exposed ports (only for reference, see https://docs.docker.com/engine/reference/builder/#expose) # exposed ports (only for reference, see https://docs.docker.com/engine/reference/builder/#expose)
EXPOSE ${HTTP_PORT}/tcp ${WS_PORT}/tcp ${CDN_PORT}/tcp ${RTC_PORT}/tcp ${ADMIN_PORT}/tcp EXPOSE ${HTTP_PORT}/tcp ${WS_PORT}/tcp ${CDN_PORT}/tcp ${RTC_PORT}/tcp ${ADMIN_PORT}/tcp
# install required apps # install required apps
RUN apk add --no-cache --update git python3 py-pip make build-base RUN apk add --no-cache --update git
RUN ln -s /usr/bin/python3 /usr/bin/python
# Run as non-root user # Run as non-root user
# RUN adduser -D fosscord # RUN adduser -D fosscord
# USER fosscord # USER fosscord
WORKDIR /srv/fosscord-server/bundle copy . /srv/fosscord-server/
ENTRYPOINT ["npm", "run", "start:bundle"]
WORKDIR /srv/fosscord-server
RUN chmod +x scripts/docker-entrypoint.sh
run rm -rf assets/cache/
ENTRYPOINT ["scripts/docker-entrypoint.sh"]

View File

@ -8,8 +8,8 @@ services:
build: . build: .
ports: ports:
- "3001-3005:3001-3005" - "3001-3005:3001-3005"
volumes: #volumes:
- ./:/srv/fosscord-server/ #- ./:/srv/fosscord-server/
environment: environment:
THREADS: ${THREADS:-1} THREADS: ${THREADS:-1}
HTTP_PORT: 3001 HTTP_PORT: 3001

View File

@ -0,0 +1,3 @@
#!/bin/sh
if [ ! -d "node_modules" ]; then apk add --no-cache --update python3 py-pip make gcc; ln -s /usr/bin/python3 /usr/bin/python; npm run setup; fi
if [ ! -d 'dist' ]; then npm run build; fi