+ Adding mysql to a pipeline specific Freechat docker build
! It's also super jank at the moment so it's not exactly what I would call "stable" Like seriously right now the entrypoint script basically just yeets mysql to the background and snuffs out its logs for the sake of brevity More work needs to be done in order to make sure that the sample user can be safely added to the mysql backend. None of this is being done a safe fashion and frankyl thats ok. Security NOTE: No effort is put forth to make this Docker image secure since it is meant to have bogus data, bogus users, and mock everything so again never use this for production.
This commit is contained in:
parent
94119e80c7
commit
a594dcb558
58
freechat-pipeline/Dockerfile
Normal file
58
freechat-pipeline/Dockerfile
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# This docker image is used for building Freechat in Gitlab pipelines
|
||||||
|
# WARN: this image uses a lot of "lazy" practices in terms of security as its
|
||||||
|
# not at all meant to be ran in a production environment. Attempts to use this
|
||||||
|
# a "production/live" are not recommended
|
||||||
|
|
||||||
|
FROM rust:slim-buster
|
||||||
|
|
||||||
|
# required for building rust things and grabbing node
|
||||||
|
RUN apt-get update && apt-get upgrade -y && apt-get install \
|
||||||
|
git default-libmysqlclient-dev pkg-config \
|
||||||
|
curl libssl-dev ca-certificates gnupg procps \
|
||||||
|
-y --no-install-recommends
|
||||||
|
|
||||||
|
|
||||||
|
# Setup node
|
||||||
|
# grab key
|
||||||
|
RUN curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -
|
||||||
|
# add binary & source ppa
|
||||||
|
RUN echo "deb https://deb.nodesource.com/node_14.x sid main" > /etc/apt/sources.list.d/nodesource.list
|
||||||
|
RUN echo "deb-src https://deb.nodesource.com/node_14.x sid main" >> /etc/apt/sources.list.d/nodesource.list
|
||||||
|
RUN apt-get update && apt-get install nodejs \
|
||||||
|
-y --no-install-recommends
|
||||||
|
|
||||||
|
# Next we install diesel for easily setting up the database tables
|
||||||
|
RUN cargo install diesel_cli --no-default-features --features mysql
|
||||||
|
|
||||||
|
# Now comes the painful part of setting mysql itself
|
||||||
|
# Database user will be 'admin'@'localhost' identified by 'password'
|
||||||
|
# Database name is 'freechat'
|
||||||
|
# Tables should be setup for us by diesel
|
||||||
|
# Also I'm using expect because of the amount of interactive prompts in the way
|
||||||
|
RUN apt-get install curl expect \
|
||||||
|
-y --no-install-recommends
|
||||||
|
|
||||||
|
RUN mkdir /opt/mysql-setup
|
||||||
|
RUN curl "https://repo.mysql.com//mysql-apt-config_0.8.17-1_all.deb" \
|
||||||
|
-o /opt/mysql-setup/mysql-apt-config_0.8.17-1_all.deb
|
||||||
|
RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install /opt/mysql-setup/mysql-apt-config_0.8.17-1_all.deb \
|
||||||
|
-y --no-install-recommends
|
||||||
|
|
||||||
|
# Use the newly installed mysql packages to install the server component
|
||||||
|
RUN export DEBIAN_FRONTEND=noninteractive && \
|
||||||
|
apt-get update && \
|
||||||
|
apt-get install mysql-community-client mysql-community-server \
|
||||||
|
-y --no-install-recommends
|
||||||
|
|
||||||
|
|
||||||
|
# Clean up from the apt-gets and things we don't do this
|
||||||
|
RUN apt-get remove curl gnupg ca-certificates -y # will go unused in regular builds
|
||||||
|
RUN apt-get autoremove -y
|
||||||
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Start the mysql service
|
||||||
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
7
freechat-pipeline/entrypoint.sh
Executable file
7
freechat-pipeline/entrypoint.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
echo Starting mysql server in background
|
||||||
|
mysqld --user=root --daemonize&
|
||||||
|
echo Starting shell
|
||||||
|
bash
|
Loading…
Reference in New Issue
Block a user