Skip to content

Commit

Permalink
Move to docker-alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
darknoon29 committed Aug 15, 2024
1 parent 454ad46 commit 0fd7e2b
Show file tree
Hide file tree
Showing 21 changed files with 181 additions and 219 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;"]
56 changes: 56 additions & 0 deletions .docker/Dockerfile.ogspy
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
FROM php:8.2-fpm-alpine3.19 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 \
git \
composer

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

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

RUN git clone -b develop https://github.com/ogsteam/ogspy /var/www/html
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-xtense /var/www/html/mod/xtense
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-tempsvols /var/www/html/mod/tempsvols
RUN git clone -b master https://github.com/ogsteam/mod-bthof /var/www/html/mod/bthof

COPY id.php /var/www/html/parameters/id.php
COPY key.php /var/www/html/parameters/key.php

WORKDIR /var/www/html

RUN composer install
# 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"
22 changes: 0 additions & 22 deletions .docker/README.md

This file was deleted.

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;
2 changes: 1 addition & 1 deletion .docker/ogspy_docker.sql → .docker/db/2-ogspy_docker.sql
Original file line number Diff line number Diff line change
Expand Up @@ -991,4 +991,4 @@ INSERT INTO `ogspy_user_building` (`user_id`, `planet_id`, `planet_name`, `coord
(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);
(1, 20, 20, 20, 20, 20, 20, 17, 20, 17, 16, 20, 20, 19, 12, 2, 23);
22 changes: 22 additions & 0 deletions .docker/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
server {
listen 80;
server_name localhost;

root /var/www/html;
index index.php index.html;

location / {
try_files $uri $uri/ /index.php?_share=;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass php8-fpm:9000;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}

location ~ /\.ht {
deny all;
}
}
65 changes: 65 additions & 0 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: my-ogspy

networks:
ogspy-network:
driver: bridge

volumes:
ogspy-db:
driver: local
ogspy-app:
driver: local

services:
db:
image: mariadb
expose:
- 3306
networks:
- ogspy-network
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: demo
MYSQL_PASSWORD: ogsteam
volumes:
- ogspy-db:/var/lib/mysql
- ./db:/docker-entrypoint-initdb.d
restart: always

ogspy:
build:
context: .
dockerfile: Dockerfile.ogspy
networks:
- ogspy-network
volumes:
- ogspy-app:/var/www/html
- ./parameters:/var/www/html/parameters
restart: always
depends_on:
- db

nginx:
build:
context: .
dockerfile: Dockerfile.nginx
volumes:
- ogspy-app:/var/www/html
ports:
- "16005:80"
networks:
- ogspy-network



phpmyadmin:
image: phpmyadmin
ports:
- "16006:80"
environment:
- PMA_HOST=db
- PMA_PORT=3306
- UPLOAD_LIMIT=50000000
networks:
- ogspy-network
restart: always
2 changes: 0 additions & 2 deletions .docker/my.cnf

This file was deleted.

4 changes: 0 additions & 4 deletions .docker/mysql-setup.sh

This file was deleted.

2 changes: 1 addition & 1 deletion .docker/id.php → .docker/parameters/id.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$table_prefix = "ogspy_";

//Paramètres de connexion à la base de données
$db_host = "localhost";
$db_host = "db";
$db_user = "admin";
$db_password = "ogsteam";
$db_database = "ogspy";
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions .docker/parameters/salt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ykaj9H5dTPV
Loading

0 comments on commit 0fd7e2b

Please sign in to comment.