diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..d7cffbcfb6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,60 @@ +FROM tgstation/byond:513.1533 as base + +FROM base as rust_g + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + git \ + ca-certificates + +WORKDIR /rust_g + +RUN apt-get install -y --no-install-recommends \ + libssl-dev \ + pkg-config \ + curl \ + gcc-multilib \ + && curl https://sh.rustup.rs -sSf | sh -s -- -y --default-host i686-unknown-linux-gnu \ + && git init \ + && git remote add origin https://github.com/tgstation/rust-g + +COPY _build_dependencies.sh . + +RUN /bin/bash -c "source _build_dependencies.sh \ + && git fetch --depth 1 origin \$RUST_G_VERSION" \ + && git checkout FETCH_HEAD \ + && ~/.cargo/bin/cargo build --release + +FROM base as dm_base + +WORKDIR /vorestation + +FROM dm_base as build + +COPY . . + +RUN DreamMaker -max_errors 0 vorestation.dme + +FROM dm_base + +EXPOSE 2303 + +RUN apt-get update \ + && apt-get install -y --no-install-recommends software-properties-common \ + && add-apt-repository ppa:ubuntu-toolchain-r/test \ + && apt-get update \ + && apt-get upgrade -y \ + && apt-get dist-upgrade -y \ + && apt-get install -y --no-install-recommends \ + libmariadb2 \ + mariadb-client \ + libssl1.0.0 \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p /root/.byond/bin + +COPY --from=rust_g /rust_g/target/release/librust_g.so /root/.byond/bin/rust_g +COPY --from=build /vorestation/ ./ + +#VOLUME [ "/vorestation/config", "/vorestation/data" ] + +ENTRYPOINT [ "DreamDaemon", "vorestation.dmb", "-port", "2303", "-trusted", "-close", "-verbose" ] diff --git a/config/docker/README.md b/config/docker/README.md new file mode 100644 index 0000000000..3c1b9b3482 --- /dev/null +++ b/config/docker/README.md @@ -0,0 +1,43 @@ +## How to set-up the Docker database + + +First, open `config/docker/mysql.env.example`, open in notepad or N++, change all the values to something else ~~or don't if you are lazy~~ for security sake. + +Then proceed to save the changed version to `mysql.env` and save it in the same directory as the `mysql.env.example` file. + +In order to get docker to use the database, it's suggested to change the `config/dbconfig.txt` to include the values in `mysql.env` file, to do this, use the hostname `db` as host! + +### Example for `config/dbconfig.txt`: + +The default database name is `tgstation` by default. Unless you change the SQL schemas, this cannot be changed. + +Keep note of the values, `*LOGIN` and `*PASSWORD` + +``` +# MySQL Connection Configuration + +# Server the MySQL database can be found at +# Examples: localhost, 200.135.5.43, www.mysqldb.com, etc. +ADDRESS db + +# MySQL server port (default is 3306) +PORT 3306 + +# Database the population, death, karma, etc. tables may be found in +DATABASE tgstation + +# Username/Login used to access the database +LOGIN sillyusername + +# Password used to access the database +PASSWORD somekindofpassword + +# The following information is for feedback tracking via the blackbox server +FEEDBACK_DATABASE tgstation +FEEDBACK_LOGIN sillyusernane +FEEDBACK_PASSWORD somekindofpassword + +# Track population and death statistics +# Comment this out to disable +#ENABLE_STAT_TRACKING +``` diff --git a/config/docker/mysql.env.example b/config/docker/mysql.env.example new file mode 100644 index 0000000000..73b37b08fd --- /dev/null +++ b/config/docker/mysql.env.example @@ -0,0 +1,6 @@ +# MySQL database root password +MYSQL_ROOT_PASSWORD=SUPERSEKRETOMYGOD +# MySQL login username +MYSQL_USERNAME=sillyusername +# MySQL login password +MYSQL_PASSWORD=somekindofpassword diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..b22b1c4ac0 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,45 @@ +version: '3' + +services: + # Virgo DM server + dreammaker: + image: vorestation:latest + restart: unless-stopped + build: + context: . + dockerfile: Dockerfile + ports: + - "2303:2303" + depends_on: + - db + volumes: + - ./config/:/vorestation/config + - gamedata:/vorestation/data + # MariaDB/MySQL database: game + # (if you don't really need this, feel free to remove this section.) + db: + image: mariadb + restart: unless-stopped + env_file: + - ./config/docker/mysql.env + volumes: + - ./SQL/tgstation_schema.sql:/docker-entrypoint-initdb.d/tgstation_schema.sql:ro + - ./SQL/feedback_schema.sql:/docker-entrypoint-initdb.d/feedback_schema.sql:ro + - database:/var/lib/mysql + # Adminer, for managing the DB, commented out by default but uncomment if you need it I guess. + #adminer: + # image: wodby/adminer + # depends_on: + # - db + # environment: + # ADMINER_DEFAULT_DB_DRIVER: mysql + # ADMINER_DEFAULT_DB_HOST: db + # ADMINER_DEFAULT_DB_NAME: tgstation + # ADMINER_DESIGN: nette + # ADMINER_PLUGINS: tables-filter tinymce + # ports: + # - 8080:9000 + +volumes: + gamedata: + database: