redis
This commit is contained in:
parent
401cdfb6c5
commit
4a61e55095
@ -71,6 +71,16 @@ services:
|
||||
- data_wordpress:/var/www/html
|
||||
restart: unless-stopped
|
||||
|
||||
redis:
|
||||
container_name: redis
|
||||
image: redis
|
||||
build:
|
||||
context: ./requirements/redis
|
||||
dockerfile: Dockerfile
|
||||
networks:
|
||||
- docker-network
|
||||
restart: unless-stopped
|
||||
|
||||
|
||||
networks:
|
||||
docker-network:
|
||||
|
||||
@ -19,7 +19,8 @@ RUN addgroup -S -g $HOST_UID mariadb && \
|
||||
# Create the necessary directories
|
||||
RUN mkdir -p /var/run/mysqld && \
|
||||
chown -R mariadb:mariadb /var/run/mysqld && \
|
||||
chown -R mariadb:mariadb /var/lib/mysql
|
||||
chown -R mariadb:mariadb /var/lib/mysql && \
|
||||
chmod -R 750 /var/lib/mysql
|
||||
|
||||
# Copy the entrypoint script and configuration files
|
||||
# and set the necessary permissions
|
||||
|
||||
@ -10,7 +10,7 @@ if [ "$1" = 'mysqld' ]; then
|
||||
echo "Database initialized."
|
||||
|
||||
# Start MariaDB temporarily to set up initial configuration
|
||||
mysqld --user=mysql --skip-networking &
|
||||
mysqld --user=mariadb --skip-networking &
|
||||
pid="$!"
|
||||
|
||||
# Wait for MariaDB to start
|
||||
|
||||
27
srcs/requirements/redis/Dockerfile
Normal file
27
srcs/requirements/redis/Dockerfile
Normal file
@ -0,0 +1,27 @@
|
||||
FROM alpine:3.20
|
||||
|
||||
# Install Redis and its dependencies
|
||||
|
||||
RUN apk add --no-cache \
|
||||
redis \
|
||||
redis-tools && \
|
||||
rm -rf /var/cache/apk/*
|
||||
|
||||
ARG HOST_UID
|
||||
|
||||
# Expose the default Redis port
|
||||
EXPOSE 6379
|
||||
|
||||
# Set the working directory
|
||||
WORKDIR /data
|
||||
|
||||
# Set Redis to run as a non-root user (optional)
|
||||
ARG HOST_UID
|
||||
RUN addgroup -S -g $HOST_UID redis && \
|
||||
adduser -S -u $HOST_UID redis -G redis && \
|
||||
chown -R redis:redis /data
|
||||
|
||||
USER redis
|
||||
|
||||
# Start Redis server
|
||||
CMD ["redis-server", "--protected-mode", "no"]
|
||||
Loading…
Reference in New Issue
Block a user