a594dcb558
! 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.
59 lines
2.2 KiB
Docker
59 lines
2.2 KiB
Docker
# 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"]
|
|
|