Skip to content

Commit

Permalink
Merge pull request #418 from OGSteam/feature/docker-alpine
Browse files Browse the repository at this point in the history
Move to docker-alpine
  • Loading branch information
darknoon29 committed Aug 16, 2024
2 parents 656dafd + 307e098 commit 13f700a
Show file tree
Hide file tree
Showing 23 changed files with 266 additions and 236 deletions.
52 changes: 0 additions & 52 deletions .docker/Dockerfile

This file was deleted.

27 changes: 27 additions & 0 deletions .docker/Dockerfile.nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
FROM nginx:stable-alpine AS base

RUN printf "\
server {\n\
listen 80;\n\
index index.php index.html;\n\
error_log /var/log/nginx/error.log;\n\
access_log /var/log/nginx/access.log;\n\
root /var/www/html;\n\
location ~ \.php$ {\n\
try_files \$uri =404;\n\
fastcgi_split_path_info ^(.+\.php)(/.+)$;\n\
fastcgi_pass ogspy:9000;\n\
fastcgi_index index.php;\n\
include fastcgi_params;\n\
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;\n\
fastcgi_param PATH_INFO \$fastcgi_path_info;\n\
}\n\
location / {\n\
try_files \$uri \$uri/ /index.php?\$query_string;\n\
gzip_static on;\n\
}\n\
}\n" > /etc/nginx/conf.d/default.conf

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
80 changes: 80 additions & 0 deletions .docker/Dockerfile.ogspy
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
FROM php:8.3-fpm-alpine3.20 AS build

RUN apk --no-cache add php-session \
php-tokenizer \
php-xml \
php-ctype \
php-curl \
php-dom \
php-fileinfo \
php-mbstring \
php-openssl \
php-pdo \
php-pdo_mysql \
php-mysqli \
php-session \
php-tokenizer \
php-xml \
php-ctype \
php-xmlwriter \
php-simplexml \
php-zip \
libzip-dev \
git \
composer

RUN docker-php-ext-install mysqli pdo_mysql zip
RUN docker-php-ext-enable mysqli pdo_mysql zip

# RUN apk --no-cache add --update nodejs npm

# Get OGSpy
RUN git clone -b develop https://github.com/ogsteam/ogspy /var/www/html

# Get OGSpy Mods
RUN git clone -b master https://github.com/ogsteam/mod-allyranking /var/www/html/mod/allyranking
RUN git clone -b master https://github.com/ogsteam/mod-attaques /var/www/html/mod/attaques
RUN git clone -b master https://github.com/ogsteam/mod-autonomie /var/www/html/mod/autonomie
RUN git clone -b master https://github.com/ogsteam/mod-autoupdate /var/www/html/mod/autoupdate
RUN git clone -b master https://github.com/ogsteam/mod-bthof /var/www/html/mod/bthof
RUN git clone -b master https://github.com/ogsteam/mod-cdr /var/www/html/mod/cdr
RUN git clone -b master https://github.com/ogsteam/mod-densite /var/www/html/mod/densite
RUN git clone -b master https://github.com/ogsteam/mod-emspyre /var/www/html/mod/emspyre
RUN git clone -b master https://github.com/ogsteam/mod-expedition /var/www/html/mod/expedition
RUN git clone -b master https://github.com/ogsteam/mod-flottes /var/www/html/mod/flottes
RUN git clone -b master https://github.com/ogsteam/mod-gestionmod /var/www/html/mod/gestionmod
RUN git clone -b master https://github.com/ogsteam/mod-graviton /var/www/html/mod/graviton
RUN git clone -b master https://github.com/ogsteam/mod-hof /var/www/html/mod/hof
RUN git clone -b master https://github.com/ogsteam/mod-hofrc /var/www/html/mod/hofrc
RUN git clone -b master https://github.com/ogsteam/mod-inactifs /var/www/html/mod/inactifs
RUN git clone -b master https://github.com/ogsteam/mod-majvisu /var/www/html/mod/majvisu
RUN git clone -b master https://github.com/ogsteam/mod-ogscalc /var/www/html/mod/ogscalc
RUN git clone -b master https://github.com/ogsteam/mod-oversight /var/www/html/mod/oversight
RUN git clone -b master https://github.com/ogsteam/mod-production /var/www/html/mod/production
RUN git clone -b master https://github.com/ogsteam/mod-quimsonde /var/www/html/mod/quimsonde
RUN git clone -b master https://github.com/ogsteam/mod-recycleurs /var/www/html/mod/recycleurs
RUN git clone -b master https://github.com/ogsteam/mod-sign /var/www/html/mod/sign
RUN git clone -b master https://github.com/ogsteam/mod-superapix /var/www/html/mod/superapix
RUN git clone -b master https://github.com/ogsteam/mod-tempsvols /var/www/html/mod/tempsvols
RUN git clone -b master https://github.com/ogsteam/mod-timeobservatory /var/www/html/mod/timeobservatory
RUN git clone -b master https://github.com/ogsteam/mod-varally /var/www/html/mod/varally
RUN git clone -b master https://github.com/ogsteam/mod-xtense /var/www/html/mod/xtense

WORKDIR /var/www/html

RUN composer install --prefer-dist --no-progress --no-dev
# RUN npm install

EXPOSE 9000

RUN printf "\
rm -Rf /var/www/html/install\n\
rm -Rf /var/www/html/.git\n\
chmod -R o+w /var/www/html/\n\
chown -R root:root /var/www/html/\n\
php-fpm\n\
" > /start.sh

RUN chmod +x "/start.sh"

ENTRYPOINT "/start.sh"
48 changes: 35 additions & 13 deletions .docker/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@

# OGSpy Docker

PHP 7.06 Maria DB
This is the environment to test your development Branch.

It contains all the necessary tools to run OGSpy.:

- Alpine Linux
- NGINX
- Maria DB
- PHP 8.3
- PHPMyAdmin

## Run Locally

Run the Docker Compose to set up the environment.

```bash
docker.exe compose -f docker-compose.yml -p my-ogspy up -d
```

## Connect to OGSpy

http://127.0.0.1:16005/

User : ogsteam
Password : ogsteam

Based on work done by tutumcloud
https://github.com/tutumcloud/lamp
## Connect to PHPMyAdmin

## Usage
http://127.0.0.1:16006/

- Get the image: `docker pull ogsteam/ogspy`
User : root
Password : password

- Run the image: `docker run -d -p80:80 --name ogspy_container ogsteam/ogspy`
## Volumes

- Install OGSpy with Database settings:
Open with your browser http://127.0.0.1 (The page could appear after some time corresponding to the service startup time)
The image will create the following volumes to let you see your files in your local environment.
- `ogspy-db` - MariaDB
- `ogspy-app` - NGINX + OGSPY

> Database : ogspy
> user : ogsteam
> password : password
## Customize your image

- When installation is finished remove install Folder:
`docker exec ogspy_container rm -Rf /app/install`
You can edit the `Dockerfile.ogspy` file to customize your image and select a customer branch to test and the PHP Version.
35 changes: 0 additions & 35 deletions .docker/apache_default

This file was deleted.

32 changes: 0 additions & 32 deletions .docker/configure.sh

This file was deleted.

38 changes: 0 additions & 38 deletions .docker/create_mysql_admin_user.sh

This file was deleted.

8 changes: 8 additions & 0 deletions .docker/db/1-DBSetup.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-- create the databases
CREATE DATABASE IF NOT EXISTS ogspy;

-- create the users for each database
CREATE USER 'admin'@'%' IDENTIFIED BY 'ogsteam';
GRANT CREATE, ALTER, INDEX, LOCK TABLES, REFERENCES, UPDATE, DELETE, DROP, SELECT, INSERT ON `ogspy`.* TO 'admin'@'%';

FLUSH PRIVILEGES;
24 changes: 0 additions & 24 deletions .docker/ogspy_docker.sql → .docker/db/2-ogspy_docker.sql
Original file line number Diff line number Diff line change
Expand Up @@ -968,27 +968,3 @@ INSERT INTO `ogspy_group`
VALUES (1, 'Standard', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1');


-- -----------------------------------------------------------------------------
-- Partie spécifique pour le docker
-- -----------------------------------------------------------------------------
-- -----------------------------------------------------------------------------
INSERT INTO `ogspy_config` VALUES ('num_of_galaxies','9');
INSERT INTO `ogspy_config` VALUES ('num_of_systems','499');
INSERT INTO `ogspy_config` VALUES ('speed_uni','1');
INSERT INTO `ogspy_config` VALUES ('speed_fleet_peaceful','1');
INSERT INTO `ogspy_config` VALUES ('speed_fleet_war','1');
INSERT INTO `ogspy_config` VALUES ('speed_fleet_holding','1');
INSERT INTO `ogspy_config` VALUES ('speed_research_divisor','1');
INSERT INTO `ogspy_config` VALUES ('version','3.3.8-dev');
INSERT INTO `ogspy_config` VALUES ('log_phperror', '1');
INSERT INTO `ogspy_user` (`user_id`, `user_name`, `user_password`, `user_regdate`, `user_active`, `user_admin`, `user_class`, `user_pwd_change`) VALUES (1, 'ogsteam', '1619d7adc23f4f633f11014d2f22b7d8', '1567070548', '1', '1', 'COL', 0);
INSERT INTO `ogspy_user_group` (`group_id`, `user_id`) VALUES (1, 1);

INSERT INTO `ogspy_user_building` (`user_id`, `planet_id`, `planet_name`, `coordinates`, `fields`, `boosters`, `temperature_min`, `temperature_max`, `Sat`, `Sat_percentage`, `FOR`, `FOR_percentage`, `M`, `M_percentage`, `C`, `C_Percentage`, `D`, `D_percentage`, `CES`, `CES_percentage`, `CEF`, `CEF_percentage`, `UdR`, `UdN`, `CSp`, `HM`, `HC`, `HD`, `Lab`, `Ter`, `DdR`, `Silo`, `Dock`, `BaLu`, `Pha`, `PoSa`) VALUES
(1, 101, 'area' , '2:330:12', 282, 'm:0:0_c:0:0_d:0:0_e:0:0_p:0_m:0' , -31, 9, 2010, 100, 848, 150, 38, 100, 34, 100, 34, 100, 12, 100, 23, 60, 7, 7, 12, 13, 9, 8, 18, 8, 1, 8, 7, 0, 0, 0),
(1, 102, 'area2' , '2:330:13', 201, 'm:30:2600000000_c:0:0_d:0:0_e:0:0_p:0_m:0', -31, 9, 2010, 100, 848, 150, 38, 100, 34, 100, 34, 100, 12, 100, 23, 0, 7, 7, 12, 13, 9, 8, 6, 8, 1, 8, 7, 0, 0, 0),
(1, 103, 'Atlantis', '2:331:5' , 291, 'm:0:0_c:0:0_d:0:0_e:0:0_p:0_m:0' , 29, 69, 2006, 100, 840, 150, 38, 100, 34, 100, 34, 100, 29, 100, 20, 70, 10, 7, 12, 13, 11, 10, 18, 6, 1, 8, 7, 0, 0, 0),
(1, 104, 'colonie' , '9:62:8' , 296, 'm:0:0_c:0:0_d:0:0_e:0:0_p:0_m:0' , 7, 47, 2200, 100, 841, 150, 38, 100, 34, 100, 34, 100, 28, 100, 20, 40, 10, 7, 12, 13, 11, 10, 18, 6, 1, 8, 7, 0, 0, 0);

INSERT INTO `ogspy_user_technology` (`user_id`, `Esp`, `Ordi`, `Armes`, `Bouclier`, `Protection`, `NRJ`, `Hyp`, `RC`, `RI`, `PH`, `Laser`, `Ions`, `Plasma`, `RRI`, `Graviton`, `Astrophysique`) VALUES
(1, 20, 20, 20, 20, 20, 20, 17, 20, 17, 16, 20, 20, 19, 12, 2, 23);
24 changes: 24 additions & 0 deletions .docker/db/3-initDocker.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

USE `ogspy`;

-- -----------------------------------------------------------------------------
-- Partie spécifique pour le docker
-- -----------------------------------------------------------------------------
-- -----------------------------------------------------------------------------
INSERT INTO `ogspy_config` VALUES ('num_of_galaxies','9');
INSERT INTO `ogspy_config` VALUES ('num_of_systems','499');
INSERT INTO `ogspy_config` VALUES ('speed_uni','1');
INSERT INTO `ogspy_config` VALUES ('speed_fleet_peaceful','1');
INSERT INTO `ogspy_config` VALUES ('speed_fleet_war','1');
INSERT INTO `ogspy_config` VALUES ('speed_fleet_holding','1');
INSERT INTO `ogspy_config` VALUES ('speed_research_divisor','1');
INSERT INTO `ogspy_config` VALUES ('version','3.3.9-dev');
INSERT INTO `ogspy_config` VALUES ('log_phperror', '1');
INSERT INTO `ogspy_user` (`user_id`, `user_name`, `user_password_s`, `user_regdate`, `user_active`, `user_admin`, `user_class`, `user_pwd_change`) VALUES (1, 'ogsteam', '$2y$10$z.6/280zsg65IoOJ/wmOC.cHIWFnKFE8TaY7JSr0DH3fnQsxg7rRW', '1567070548', '1', '1', 'COL', 0);
INSERT INTO `ogspy_user_group` (`group_id`, `user_id`) VALUES (1, 1);

INSERT INTO `ogspy_user_building` (`user_id`, `planet_id`, `planet_name`, `coordinates`, `fields`, `boosters`, `temperature_min`, `temperature_max`, `Sat`, `Sat_percentage`, `FOR`, `FOR_percentage`, `M`, `M_percentage`, `C`, `C_Percentage`, `D`, `D_percentage`, `CES`, `CES_percentage`, `CEF`, `CEF_percentage`, `UdR`, `UdN`, `CSp`, `HM`, `HC`, `HD`, `Lab`, `Ter`, `DdR`, `Silo`, `Dock`, `BaLu`, `Pha`, `PoSa`)
VALUES (1, 101, 'area' , '2:330:12', 282, 'm:0:0_c:0:0_d:0:0_e:0:0_p:0_m:0', -31, 9, 2010, 100, 848, 150, 38, 100, 34, 100, 34, 100, 12, 100, 23, 60, 7, 7, 12, 13, 9, 8, 18, 8, 1, 8, 7, 0, 0, 0);

INSERT INTO `ogspy_user_technology` (`user_id`, `Esp`, `Ordi`, `Armes`, `Bouclier`, `Protection`, `NRJ`, `Hyp`, `RC`, `RI`, `PH`, `Laser`, `Ions`, `Plasma`, `RRI`, `Graviton`, `Astrophysique`) VALUES
(1, 20, 20, 20, 20, 20, 20, 17, 20, 17, 16, 20, 20, 19, 12, 2, 23);
Loading

0 comments on commit 13f700a

Please sign in to comment.