diff --git a/.github/relase_body_template.md b/.github/release_body_template.md similarity index 100% rename from .github/relase_body_template.md rename to .github/release_body_template.md diff --git a/.github/workflows/docker-publish-api.yml b/.github/workflows/docker-publish-api.yml index cc35562a..fd3c9cfb 100644 --- a/.github/workflows/docker-publish-api.yml +++ b/.github/workflows/docker-publish-api.yml @@ -3,7 +3,7 @@ name: docker-publish-api on: push: paths: - - "api/**" + - "src/api/**" jobs: docker-api: diff --git a/.github/workflows/docker-publish-cdn.yml b/.github/workflows/docker-publish-cdn.yml index 86eae9d6..9fae9f63 100644 --- a/.github/workflows/docker-publish-cdn.yml +++ b/.github/workflows/docker-publish-cdn.yml @@ -3,7 +3,7 @@ name: docker-publish-cdn on: push: paths: - - "cdn/**" + - "src/cdn/**" jobs: docker-cdn: diff --git a/.github/workflows/docker-publish-gateway.yml b/.github/workflows/docker-publish-gateway.yml index 21c3333e..ab3aa7f2 100644 --- a/.github/workflows/docker-publish-gateway.yml +++ b/.github/workflows/docker-publish-gateway.yml @@ -3,7 +3,7 @@ name: docker-publish-gw on: push: paths: - - "gateway/**" + - "src/gateway/**" jobs: docker-gw: diff --git a/Dockerfile b/Dockerfile index 64130e51..369316ed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,17 +6,21 @@ ENV WS_PORT=3002 ENV CDN_PORT=3003 ENV RTC_PORT=3004 ENV ADMIN_PORT=3005 +ENV THREADS=1 # 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 # install required apps -RUN apk add --no-cache --update git python3 py-pip make build-base -RUN ln -s /usr/bin/python3 /usr/bin/python +RUN apk add --no-cache --update git # Run as non-root user # RUN adduser -D fosscord # USER fosscord -WORKDIR /srv/fosscord-server/bundle -ENTRYPOINT ["npm", "run", "start:bundle"] \ No newline at end of file +copy . /srv/fosscord-server/ + +WORKDIR /srv/fosscord-server +RUN chmod +x scripts/docker-entrypoint.sh +run rm -rf assets/cache/ +ENTRYPOINT ["scripts/docker-entrypoint.sh"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 8da4010c..0cf1463a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,8 +8,8 @@ services: build: . ports: - "3001-3005:3001-3005" - volumes: - - ./:/srv/fosscord-server/ + #volumes: + #- ./:/srv/fosscord-server/ environment: THREADS: ${THREADS:-1} HTTP_PORT: 3001 diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh new file mode 100644 index 00000000..ae1ab6eb --- /dev/null +++ b/scripts/docker-entrypoint.sh @@ -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