mirror of
https://github.com/sigmasternchen/mobmash.click
synced 2025-03-14 23:59:01 +00:00
chore: Add local Docker setup
This commit is contained in:
parent
30dff25191
commit
d6029d5e08
4 changed files with 79 additions and 0 deletions
1
local-dev/.env
Normal file
1
local-dev/.env
Normal file
|
@ -0,0 +1 @@
|
|||
COMPOSE_PROJECT_NAME=mobmash
|
13
local-dev/Dockerfile
Normal file
13
local-dev/Dockerfile
Normal file
|
@ -0,0 +1,13 @@
|
|||
FROM php:8.2-cli
|
||||
|
||||
RUN apt -y update && apt -y upgrade
|
||||
RUN apt -y install npm git libpq-dev
|
||||
RUN docker-php-ext-install pdo_pgsql pgsql
|
||||
|
||||
WORKDIR /var/www/
|
||||
|
||||
COPY ./entrypoint.sh ./entrypoint.sh
|
||||
|
||||
EXPOSE 1337
|
||||
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
36
local-dev/docker-compose.yml
Normal file
36
local-dev/docker-compose.yml
Normal file
|
@ -0,0 +1,36 @@
|
|||
version: '3.8'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
environment:
|
||||
POSTGRES_USER: myuser
|
||||
POSTGRES_PASSWORD: mypassword
|
||||
POSTGRES_DB: mydatabase
|
||||
ports:
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
|
||||
mobmash:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
POSTGRES_HOST: postgres
|
||||
POSTGRES_USER: myuser
|
||||
POSTGRES_PASSWORD: mypassword
|
||||
POSTGRES_DBNAME: mydatabase
|
||||
UPDATER_CONTACT_EMAIL: dev@localhost
|
||||
GENERAL_CONTACT_EMAIL: dev@localhost
|
||||
PRIVACY_CONTACT: John Doe
|
||||
PRIVACY_CONTACT_EMAIL: dev@localhost
|
||||
depends_on:
|
||||
- postgres
|
||||
volumes:
|
||||
- ../:/var/www/mobmash:Z
|
||||
ports:
|
||||
- "8080:8080"
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
29
local-dev/entrypoint.sh
Executable file
29
local-dev/entrypoint.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
cd /var/www/mobmash
|
||||
|
||||
# Build JS
|
||||
cd resources/js/
|
||||
npm install
|
||||
npm run build
|
||||
cd /var/www/mobmash
|
||||
|
||||
# Fetch Emoji
|
||||
./bin/setup/fetch-emoji.sh
|
||||
|
||||
# Prepare Config
|
||||
cp config.templ.php config.php
|
||||
sed -i -E 's/%DBHOST%/'"$POSTGRES_HOST"'/g' config.php
|
||||
sed -i -E 's/%DBNAME%/'"$POSTGRES_DBNAME"'/g' config.php
|
||||
sed -i -E 's/%DBUSER%/'"$POSTGRES_USER"'/g' config.php
|
||||
sed -i -E 's/%DBPASSWORD%/'"$POSTGRES_PASSWORD"'/g' config.php
|
||||
sed -i -E 's/%UPDATER_EMAIL%/'"$UPDATER_CONTACT_EMAIL"'/g' config.php
|
||||
sed -i -E 's/%GENERAL_EMAIL%/'"$GENERAL_CONTACT_EMAIL"'/g' config.php
|
||||
sed -i -E 's/%PRIVACY_CONTACT%/'"$PRIVACY_CONTACT"'/g' config.php
|
||||
sed -i -E 's/%PRIVACY_EMAIL%/'"$PRIVACY_CONTACT_EMAIL"'/g' config.php
|
||||
|
||||
# Fetch MC Wiki data (if necessary)
|
||||
test -f ./html/images/mobs/cow.png || php ./bin/cron/updateData.php
|
||||
|
||||
# Start dev server
|
||||
php -S 0.0.0.0:8080 -t /var/www/mobmash/html
|
Loading…
Reference in a new issue