mariadb running ok

This commit is contained in:
hugo gogo
2022-09-06 17:37:52 +02:00
parent 409599d558
commit 96290b796b
4 changed files with 20 additions and 28 deletions

View File

@@ -25,7 +25,8 @@ RESET = "\e[0m"
COMPOSE = ./srcs/docker-compose.yml COMPOSE = ./srcs/docker-compose.yml
IMAGES = test \ IMAGES = test \
nginx nginx \
mariadb
HOME_D = $(shell echo $(HOME)) HOME_D = $(shell echo $(HOME))

View File

@@ -34,13 +34,13 @@ services:
# container_name: mynginx_debian # container_name: mynginx_debian
# --------------------------------- # ---------------------------------
# mariadb: mariadb:
## restart: on-failure # restart: on-failure
# build: build:
# context: ./requirements/mariadb context: ./requirements/mariadb
# dockerfile: Dockerfile dockerfile: Dockerfile
# image: mariadb image: mariadb
# container_name: mymariadb container_name: mymariadb
# --------------------------------- # ---------------------------------

View File

@@ -1,11 +1,15 @@
FROM debian:buster FROM debian:buster
RUN apt update && apt install -y mariadb-client mariadb-server ARG DEBIAN_FRONTEND=noninteractive
RUN service mysql start RUN apt update && \
RUN mariadb --execute="create database db_hugo_test;" apt install -y mariadb-client mariadb-server && \
RUN mariadb --execute="create user 'u_hugo_test'@'localhost' identified by 'hello';" rm -rf /var/lib/apt/lists/* && \
RUN mariadb --execute="grant all privileges on *.* to 'u_hugo_test'@'localhost' with grant option;" \
service mysql start && \
mariadb --execute="create database db_hugo_test;" && \
mariadb --execute="create user 'u_hugo_test'@'localhost' identified by 'hello';" && \
mariadb --execute="grant all privileges on *.* to 'u_hugo_test'@'localhost' with grant option;"
CMD [ "mysqld" ] CMD [ "mysqld" ]

View File

@@ -1,20 +1,10 @@
# alpine : FROM debian:buster
FROM alpine:3.15
# debian :
#FROM debian:buster
# alpine : RUN apt update && apt install -y nginx openssl && rm -rf /var/lib/apt/lists/*
RUN apk add nginx openssl
# debian :
#RUN apt update && apt install -y nginx openssl && rm -rf /var/lib/apt/lists/*
# for debug # for debug
#RUN apt install -y procps vim #RUN apt install -y procps vim
# alpine :
RUN mkdir -p /etc/ssl/private
RUN mkdir -p /etc/ssl/certs
# create ssl certificate # create ssl certificate
RUN openssl req -newkey rsa:2048 -nodes -x509 \ RUN openssl req -newkey rsa:2048 -nodes -x509 \
-keyout /etc/ssl/private/hulamy.42.fr.key -out /etc/ssl/certs/hulamy.42.fr.crt \ -keyout /etc/ssl/private/hulamy.42.fr.key -out /etc/ssl/certs/hulamy.42.fr.crt \
@@ -31,9 +21,6 @@ COPY ./conf/https/index.html /data/wwws/
CMD [ "nginx", "-g", "daemon off;" ] CMD [ "nginx", "-g", "daemon off;" ]
#
# run nginx with alpine :
# https://www.techtarget.com/searchitoperations/tutorial/Use-Docker-and-Alpine-Linux-to-build-lightweight-containers
# #
# -g 'daemon off' : # -g 'daemon off' :
# daemon off, to avoid the main process of nginx to quit after creating its childs, and therefore make docker exit # daemon off, to avoid the main process of nginx to quit after creating its childs, and therefore make docker exit