From 7218680efa9d8b682d2d7e794457b2e4355ea24e Mon Sep 17 00:00:00 2001 From: shihaam Date: Mon, 7 Nov 2022 23:39:50 +0500 Subject: [PATCH] working i think --- .gitignore | 7 ++++++ Dockerfile | 46 ++++++++++++++++++++++++++++++++++++ buildfiles/auto_config.sh | 9 +++++++ buildfiles/start_services.sh | 9 +++++++ docker-compose.yml | 16 +++++++++++++ 5 files changed, 87 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 buildfiles/auto_config.sh create mode 100644 buildfiles/start_services.sh create mode 100644 docker-compose.yml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6bb2646 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +init +init/ +init/* + +synapse +synapse/ +synapse/* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4e84224 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,46 @@ +FROM debian:sid-slim +WORKDIR /root + +ARG PHPVERSION=7.4 +SHELL ["/bin/bash", "-c"] +#Initial update packges +RUN apt update && apt upgrade -y + +# Language setup +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 +RUN apt install locales -y \ + && apt auto-remove -y \ + && apt clean -y +RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \ + && locale-gen + +# Enable Backports +#RUN echo 'deb http://deb.debian.org/debian bullseye-backports main' > /etc/apt/sources.list.d/bullseye-backports.list \ +# && apt update + +# Installing basic tools +RUN apt install bzip2 zip unzip git gnupg2 ca-certificates lsb-release apt-transport-https wget curl nano vim -y --no-install-recommends \ + && apt auto-remove -y \ + && apt clean -y + +# Platform-specific prerequisites to run python module +RUN apt install build-essential python3-dev libffi-dev \ + python3-pip python3-setuptools sqlite3 \ + libssl-dev virtualenv libjpeg-dev libxslt1-dev -y --no-install-recommends + +RUN mkdir -p ~/synapse \ + && virtualenv -p python3 ~/env \ + && source ~/env/bin/activate \ + && pip install --upgrade pip \ + && pip install --upgrade setuptools \ + && pip install matrix-synapse + + +#autostart files +COPY buildfiles/auto_config.sh . +COPY buildfiles/start_services.sh . +RUN chmod +x auto_config.sh +RUN chmod +x start_services.sh +CMD ["./start_services.sh"] diff --git a/buildfiles/auto_config.sh b/buildfiles/auto_config.sh new file mode 100644 index 0000000..bd21217 --- /dev/null +++ b/buildfiles/auto_config.sh @@ -0,0 +1,9 @@ +#!/bin/bash +cd /root/synapse +source /root/env/bin/activate +python -m synapse.app.homeserver \ + --server-name $SERVERNAME \ + --config-path homeserver.yaml \ + --generate-config \ + --report-stats=$REPORTSTATUS +touch /root/init/init diff --git a/buildfiles/start_services.sh b/buildfiles/start_services.sh new file mode 100644 index 0000000..0026d83 --- /dev/null +++ b/buildfiles/start_services.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +#auto configs +if ! [ -f /root/init/init ] +then /root/auto_config.sh +fi +cd /root/synapse +source /root/env/bin/activate +synctl start --no-daemonize diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c99b341 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3.5' +services: +######################### + app: + build: . + image: git.shihaam.dev/dockerfiles/matrix-synapse + hostname: matrix-synapse + volumes: + - ./init:/root/init + - ./synapse:/root/synapse + ports: + - 8006:80 + restart: always + environment: + REPORTSTATUS: 'no' + SERVERNAME: matrix.shihaam.me