adminer and ftp WIP
This commit is contained in:
parent
856ac6a99b
commit
63f9b5b9b0
12
Makefile
12
Makefile
@ -6,7 +6,7 @@
|
||||
# By: whaffman <whaffman@student.codam.nl> +#+ #
|
||||
# +#+ #
|
||||
# Created: 2025/05/12 15:33:56 by whaffman #+# #+# #
|
||||
# Updated: 2025/05/22 10:25:47 by whaffman ######## odam.nl #
|
||||
# Updated: 2025/05/22 16:23:30 by whaffman ######## odam.nl #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
@ -15,13 +15,13 @@ DOCKER_COMPOSE = docker compose
|
||||
DOCKER_COMPOSE_FILE = ./srcs/docker-compose.yml
|
||||
DOCKER_ENV_FILE = ./srcs/.env
|
||||
|
||||
DATA_DIR = ./data
|
||||
DATA_DIR = /home/whaffman/data
|
||||
WORDPRESS_DATA_DIR = $(DATA_DIR)/wordpress
|
||||
MARIADB_DATA_DIR = $(DATA_DIR)/mariadb
|
||||
|
||||
UID := $(shell id -u)
|
||||
|
||||
DC = $(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(DOCKER_ENV_FILE) --project-name ""
|
||||
DC = $(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(DOCKER_ENV_FILE) --project-name ""
|
||||
|
||||
.PHONY: all build up down remove
|
||||
|
||||
@ -36,8 +36,8 @@ $(MARIADB_DATA_DIR):
|
||||
@echo "$(gub)Creating MariaDB data directory...$(reset)"
|
||||
@mkdir -p $(MARIADB_DATA_DIR)
|
||||
@chmod 777 $(MARIADB_DATA_DIR)
|
||||
|
||||
|
||||
|
||||
|
||||
build: $(WORDPRESS_DATA_DIR) $(MARIADB_DATA_DIR)
|
||||
@echo "$(gub)Building Docker containers...$(reset)"
|
||||
$(DC) build --build-arg HOST_UID=$(UID)
|
||||
@ -61,7 +61,7 @@ clean:
|
||||
@echo "$(gub)Removing Docker images...$(reset)"
|
||||
@docker rmi -f $(shell docker images -q)
|
||||
|
||||
|
||||
|
||||
|
||||
logs:
|
||||
@echo "$(gub)Displaying logs...$(reset)"
|
||||
|
||||
@ -81,6 +81,26 @@ services:
|
||||
- docker-network
|
||||
restart: unless-stopped
|
||||
|
||||
ftp:
|
||||
container_name: ftp
|
||||
image: ftp
|
||||
build:
|
||||
context: ./requirements/ftp
|
||||
dockerfile: Dockerfile
|
||||
depends_on:
|
||||
- wordpress
|
||||
environment:
|
||||
- FTP_USER=${FTP_USER}
|
||||
- FTP_PASS=${FTP_PASS}
|
||||
- FTP_PORT=${FTP_PORT}
|
||||
networks:
|
||||
- docker-network
|
||||
ports:
|
||||
- '21:21'
|
||||
- '30000-30009:30000-30009'
|
||||
volumes:
|
||||
- data_wordpress:/var/www/html
|
||||
restart: unless-stopped
|
||||
|
||||
networks:
|
||||
docker-network:
|
||||
@ -93,12 +113,12 @@ volumes:
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
device: ../data/mariadb
|
||||
device: /home/whaffman/data/mariadb
|
||||
o: bind
|
||||
data_wordpress:
|
||||
name: data_wordpress
|
||||
driver: local
|
||||
driver_opts:
|
||||
type: none
|
||||
device: ../data/wordpress
|
||||
device: /home/whaffman/data/wordpress
|
||||
o: bind
|
||||
|
||||
16
srcs/requirements/adminer/Dockerfile
Normal file
16
srcs/requirements/adminer/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN apk add --no-cache \
|
||||
php83 \
|
||||
php83-fpm \
|
||||
php83-mysqli \
|
||||
php83-mbstring \
|
||||
php83-session \
|
||||
mariadb-client \
|
||||
curl &&\
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
# Add a new user and group
|
||||
# Create group with GID = HOST_UID, then user with UID = HOST_UID and GID = HOST_UID
|
||||
ARG HOST_UID
|
||||
|
||||
17
srcs/requirements/ftp/Dockerfile
Normal file
17
srcs/requirements/ftp/Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN apk add --no-cache \
|
||||
vsftpd \
|
||||
&& rm -rf /var/cache/apk/*
|
||||
|
||||
RUN adduser -D -h /home/ftpuser -s /bin/false ftpuser && \
|
||||
echo "ftpuser:password" | chpasswd && \
|
||||
mkdir -p /home/ftpuser/ftp && \
|
||||
chmod 750 /home/ftpuser/ftp && \
|
||||
chown -R ftpuser:ftpuser /home/ftpuser/ftp
|
||||
|
||||
COPY ./conf/vsftpd.conf /etc/vsftpd/vsftpd.conf
|
||||
|
||||
EXPOSE 20 21 30000-30009
|
||||
|
||||
CMD ["vsftpd", "/etc/vsftpd/vsftpd.conf"]
|
||||
34
srcs/requirements/ftp/conf/vsftpd.conf
Normal file
34
srcs/requirements/ftp/conf/vsftpd.conf
Normal file
@ -0,0 +1,34 @@
|
||||
# Allow local users to log in
|
||||
local_enable=YES
|
||||
|
||||
# Enable write permissions for local users
|
||||
write_enable=YES
|
||||
|
||||
# Restrict users to their home directories
|
||||
chroot_local_user=YES
|
||||
|
||||
# Enable passive mode (useful for NAT and firewalls)
|
||||
pasv_enable=YES
|
||||
pasv_min_port=30000
|
||||
pasv_max_port=30009
|
||||
|
||||
# Disable anonymous login
|
||||
anonymous_enable=NO
|
||||
|
||||
# Set the FTP banner message
|
||||
ftpd_banner=Welcome to the FTP server.
|
||||
|
||||
# Listen on IPv4
|
||||
listen=YES
|
||||
|
||||
# Disable IPv6 (optional, if not needed)
|
||||
listen_ipv6=NO
|
||||
|
||||
# Set the maximum number of clients
|
||||
max_clients=10
|
||||
|
||||
# Set the maximum number of connections per IP
|
||||
max_per_ip=5
|
||||
|
||||
# Log all FTP requests
|
||||
xferlog_enable=YES
|
||||
1
srcs/requirements/ftp/tools/docker-entrypoint.sh
Normal file
1
srcs/requirements/ftp/tools/docker-entrypoint.sh
Normal file
@ -0,0 +1 @@
|
||||
|
||||
@ -6,11 +6,6 @@ RUN apk add --no-cache \
|
||||
redis && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ARG HOST_UID
|
||||
|
||||
# Expose the default Redis port
|
||||
EXPOSE 6379
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /data
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user