pica now has mariadb client in environment, and a composition with mariadb to run it
This commit is contained in:
parent
7a54d5025f
commit
d516963219
@ -5,5 +5,6 @@ RUN \
|
||||
apk add --no-cache \
|
||||
fcgi \
|
||||
fcgi++ \
|
||||
mariadb-connector-c \
|
||||
&& \
|
||||
mkdir /run/pica
|
||||
|
@ -1,18 +1,25 @@
|
||||
version: "3"
|
||||
version: "4"
|
||||
services:
|
||||
pica:
|
||||
image: thebluestbird/pica-standalone:latest
|
||||
volumes:
|
||||
- picarun:/run/pica
|
||||
- mysqld:/run/mysqld
|
||||
depends_on:
|
||||
- maria
|
||||
apache:
|
||||
build: .
|
||||
build: ./apache
|
||||
image: thebluestbird/pica-apache:latest
|
||||
volumes:
|
||||
- picarun:/run/pica
|
||||
ports:
|
||||
- 8080:80
|
||||
links:
|
||||
- pica
|
||||
maria:
|
||||
build: ./maria
|
||||
image: thebluestbird/pica-maria:latest
|
||||
volumes:
|
||||
- mysqld:/run/mysqld
|
||||
volumes:
|
||||
picarun:
|
||||
mysqld:
|
||||
|
19
pica-maria-apache/maria/Dockerfile
Normal file
19
pica-maria-apache/maria/Dockerfile
Normal file
@ -0,0 +1,19 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
FROM alpine:latest
|
||||
RUN \
|
||||
apk add --no-cache \
|
||||
mariadb \
|
||||
mariadb-client \
|
||||
&& \
|
||||
mkdir -p /run/mysqld && \
|
||||
chown mysql:mysql /run/mysqld
|
||||
|
||||
COPY my.cnf /etc/mysql/my.cnf
|
||||
COPY createDB.sql /root/
|
||||
COPY createDB.sh /root/
|
||||
|
||||
RUN mysql_install_db && \
|
||||
chmod +x root/createDB.sh && \
|
||||
root/createDB.sh
|
||||
|
||||
CMD ["mysqld", "--console"]
|
25
pica-maria-apache/maria/createDB.sh
Normal file
25
pica-maria-apache/maria/createDB.sh
Normal file
@ -0,0 +1,25 @@
|
||||
/usr/bin/mysqld_safe &
|
||||
|
||||
# wait for it to start
|
||||
echo -n "wait for db to start"
|
||||
|
||||
c=1
|
||||
while [[ $c -le 10 ]]
|
||||
do
|
||||
echo 'SELECT 1' | /usr/bin/mysql &> /dev/null
|
||||
# echo "R=$?"
|
||||
if [ $? -eq 0 ]; then
|
||||
break
|
||||
fi
|
||||
echo "."
|
||||
sleep 1
|
||||
let c=c+1
|
||||
done
|
||||
echo "C=$c"
|
||||
|
||||
if [ $c -eq 11 ]; then
|
||||
echo "database failed to start"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mysql < /root/createDB.sql
|
4
pica-maria-apache/maria/createDB.sql
Normal file
4
pica-maria-apache/maria/createDB.sql
Normal file
@ -0,0 +1,4 @@
|
||||
CREATE DATABASE IF NOT EXISTS pica;
|
||||
|
||||
CREATE USER IF NOT EXISTS 'pica'@'localhost' IDENTIFIED BY 'pica';
|
||||
GRANT ALL PRIVILEGES ON pica.* TO 'pica'@'localhost';
|
30
pica-maria-apache/maria/my.cnf
Normal file
30
pica-maria-apache/maria/my.cnf
Normal file
@ -0,0 +1,30 @@
|
||||
[mysqld]
|
||||
datadir=/var/lib/mysql
|
||||
socket=/run/mysqld/mysqld.sock
|
||||
user=mysql
|
||||
# Disabling symbolic-links is recommended to prevent assorted security risks
|
||||
symbolic-links=0
|
||||
|
||||
# Custom settings for performance and security
|
||||
key_buffer_size=16M
|
||||
max_allowed_packet=16M
|
||||
thread_stack=192K
|
||||
thread_cache_size=8
|
||||
query_cache_limit=1M
|
||||
query_cache_size=16M
|
||||
|
||||
# InnoDB settings
|
||||
innodb_buffer_pool_size=128M
|
||||
innodb_log_file_size=64M
|
||||
innodb_flush_method=O_DIRECT
|
||||
innodb_flush_log_at_trx_commit=2
|
||||
|
||||
# Character set and collation
|
||||
character-set-server=utf8mb4
|
||||
collation-server=utf8mb4_unicode_ci
|
||||
|
||||
[client]
|
||||
default-character-set=utf8mb4
|
||||
|
||||
[mysql]
|
||||
default-character-set=utf8mb4
|
9
pica-maria-apache/maria/vhost-pica.conf
Normal file
9
pica-maria-apache/maria/vhost-pica.conf
Normal file
@ -0,0 +1,9 @@
|
||||
<Location /pica>
|
||||
<IfModule mod_headers.c>
|
||||
Header set Access-Control-Allow-Origin "*"
|
||||
Header set Access-Control-Allow-Headers: "*"
|
||||
</IfModule>
|
||||
|
||||
ProxyPass "unix:/run/pica/pica.sock|fcgi://localhost"
|
||||
ProxyPassReverse "http://localhost"
|
||||
</Location>
|
@ -9,18 +9,17 @@ RUN \
|
||||
fcgi-dev \
|
||||
cmake \
|
||||
make \
|
||||
curl \
|
||||
&& \
|
||||
mkdir build && \
|
||||
cd /build && \
|
||||
curl -o pica.tar.gz https://git.macaw.me/blue/pica/archive/main.tar.gz && \
|
||||
tar -xvzf pica.tar.gz && \
|
||||
cd pica && \
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
cmake .. && \
|
||||
cmake --build .
|
||||
mariadb-connector-c-dev
|
||||
|
||||
ADD https://git.macaw.me/blue/pica/archive/main.tar.gz pica/
|
||||
WORKDIR pica
|
||||
RUN tar -xvzf main.tar.gz && \
|
||||
cd pica && \
|
||||
mkdir build && \
|
||||
cd build && \
|
||||
cmake .. && \
|
||||
cmake --build .
|
||||
|
||||
FROM thebluestbird/pica-environment:latest
|
||||
COPY --from=0 /build/pica/build/pica /usr/bin/
|
||||
COPY --from=0 /pica/pica/build/pica /usr/bin/
|
||||
CMD ["/usr/bin/pica"]
|
||||
|
Loading…
Reference in New Issue
Block a user