Skip to content

Commit 79e1411

Browse files
author
seungwonme
committed
Update
1 parent bfe11a7 commit 79e1411

30 files changed

+716
-132
lines changed
File renamed without changes.

docker/inception/Makefile

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
FG_BLACK = \033[90m
2+
FG_RED = \033[91m
3+
FG_GREEN = \033[92m
4+
FG_YELLOW = \033[93m
5+
FG_BLUE = \033[94m
6+
FG_MAGENTA = \033[95m
7+
FG_CYAN = \033[96m
8+
FG_WHITE = \033[97m
9+
FG_DEFAULT = \033[39m
10+
11+
DEFAULT = \033[0m
12+
BOLD = \033[1m
13+
ITALIC = \033[3m
14+
UNDERLINE = \033[4m
15+
REVERSE = \033[7m
16+
STRIKETHROUGH = \033[9m
17+
18+
BG_BLACK = \033[100m
19+
BG_RED = \033[101m
20+
BG_GREEN = \033[102m
21+
BG_YELLOW = \033[103m
22+
BG_BLUE = \033[104m
23+
BG_MAGENTA = \033[105m
24+
BG_CYAN = \033[106m
25+
BG_WHITE = \033[107m
26+
BG_DEFAULT = \033[49m
27+
28+
RESET = \033[0m
29+
30+
up:
31+
@docker-compose up -d
32+
@echo "$(FG_GREEN)Connect to $(FG_WHITE)$(UNDERLINE)http://localhost$(RESET)"
33+
34+
build:
35+
@docker-compose build
36+
37+
down:
38+
@docker-compose down
39+
@echo "$(FG_RED)Disconnected$(RESET)"
40+
41+
stop:
42+
@docker-compose stop
43+
@echo "$(YELLOW)Stopped$(RESET)"
44+
45+
start:
46+
@docker-compose start
47+
@echo "$(FG_GREEN)Started$(RESET)"
48+
49+
re:
50+
@echo "$(FG_GREEN)Restarted$(RESET)"
51+
@docker-compose restart
52+
53+
logs:
54+
@echo "$(FG_CYAN)Logging$(RESET)"
55+
@docker-compose logs -f
56+
57+
ps:
58+
@echo "$(FG_MAGENTA)Status$(RESET)"
59+
@docker-compose ps
60+
61+
clean:
62+
@docker-compose down -v
63+
@docker system prune -af --volumes
64+
@echo "$(FG_BLUE)Cleaned up$(RESET)"
65+
66+
.PHONY: build up down stop start re logs ps clean
67+

docker/inception/nginx/nginx.conf

Lines changed: 0 additions & 43 deletions
This file was deleted.

docker/inception/srcs/.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
DOMAIN_NAME=seunan.42.fr
2+
3+
# MYSQL SETUP
4+
MYSQL_ROOT_PASSWORD=rt0406
5+
MYSQL_USER=seunan
6+
MYSQL_PASSWORD=db0406
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
services:
2+
mariadb:
3+
build:
4+
context: ./requirements/mariadb
5+
# dockerfile: Dockerfile # 파일명이 Dockerfile이 아니면 명시해줘야 함
6+
container_name: mariadb
7+
restart: unless-stopped
8+
env_file: .env
9+
# .env 파일에 정의된 것 외에 추가 환경 변수를 추가
10+
environment:
11+
- MYSQL_DATABASE=wordpress
12+
# dbdata라는 명명된 볼륨을 /var/lib/mysql 디렉토리에 마운트
13+
volumes:
14+
- dbdata:/var/lib/mysql
15+
# 이미지에 대한 기본 CMD 지침을 재정의
16+
command: "--default-authentication-plugin=mysql_native_password"
17+
networks:
18+
- app-network
19+
wordpress:
20+
depends_on:
21+
- mariadb
22+
build:
23+
context: ./requirements/wordpress
24+
container_name: wordpress
25+
restart: unless-stopped
26+
env_file: .env
27+
environment:
28+
- WORDPRESS_DB_HOST=mariadb:3306
29+
- WORDPRESS_DB_USER=$MYSQL_USER
30+
- WORDPRESS_DB_PASSWORD=$MYSQL_PASSWORD
31+
- WORDPRESS_DB_NAME=wordpress
32+
volumes:
33+
- wordpress:/var/www/html
34+
networks:
35+
- app-network
36+
webserver:
37+
depends_on:
38+
- wordpress
39+
build:
40+
context: ./requirements/nginx
41+
container_name: webserver
42+
restart: unless-stopped
43+
ports:
44+
- "80:80"
45+
volumes:
46+
- wordpress:/var/www/html
47+
- ./nginx-conf:/etc/nginx/conf.d
48+
- certbot-etc:/etc/letsencrypt
49+
networks:
50+
- app-network
51+
certbot:
52+
depends_on:
53+
- webserver
54+
image: certbot/certbot
55+
container_name: certbot
56+
volumes:
57+
- certbot-etc:/etc/letsencrypt
58+
- wordpress:/var/www/html
59+
command: certonly --webroot --webroot-path=/var/www/html --email [email protected] --agree-tos --no-eff-email --staging -d seunan.42.fr -d www.seunan.42.fr
60+
61+
volumes:
62+
certbot-etc:
63+
wordpress:
64+
dbdata:
65+
66+
networks:
67+
app-network:
68+
driver: bridge

docker/inception/srcs/requirements/mariadb/.dockerignore

Whitespace-only changes.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Base image
2+
FROM alpine:3.18
3+
4+
RUN apk update \
5+
&& apk add mariadb-server
6+
7+
EXPOSE 3306
8+
9+
HEALTHCHECK --start-period=5m \
10+
CMD mariadb -e 'SELECT @@datadir;' || exit 1
11+
12+
CMD ["mariadbd"]
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# MariaDB Container
2+
3+
[MariaDB - Alpine Linux](https://wiki.alpinelinux.org/wiki/MariaDB)
4+
[Running mysql in the foreground in centos - Stack Overflow](https://stackoverflow.com/questions/24563762/running-mysql-in-the-foreground-in-centos)
5+
[MariaDB](https://mariadb.com/kb/en/creating-a-custom-container-image/)

docker/inception/srcs/requirements/nginx/.dockerignore

Whitespace-only changes.

docker/inception/nginx/Dockerfile renamed to docker/inception/srcs/requirements/nginx/Dockerfile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@
22
FROM alpine:3.18
33

44
RUN apk update \
5-
&& apk add nginx openssl \
5+
&& apk add --no-cache nginx openssl \
66
&& mkdir -p /var/www/html /var/www/css /etc/nginx/ssl \
77
&& openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt -subj "/C=KR/ST=Seoul/L=Seoul/O=42Seoul/OU=Cadet/CN=localhost"
88

9-
109
# Copy the configuration file
11-
COPY nginx.conf /etc/nginx/nginx.conf
12-
COPY index.html /var/www/index.html
13-
COPY 404.html /var/www/html/404.html
14-
COPY style.css /var/www/css/style.css
10+
COPY conf/default.conf /etc/nginx/http.d/default.conf
1511

1612
# Port to expose, Just documentation(Not necessary)
1713
EXPOSE 443/tcp

0 commit comments

Comments
 (0)