-
Notifications
You must be signed in to change notification settings - Fork 34
/
Dockerfile
47 lines (38 loc) · 1.39 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
FROM rust:buster
ARG DEBIAN_FRONTEND=noninteractive
RUN echo "deb http://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list && \
sed -i 's/ main$/ main contrib/g' /etc/apt/sources.list && \
apt update && \
apt dist-upgrade -y && \
apt install -y \
cron \
geoipupdate \
pdns-backend-remote \
pdns-server \
python-six \
supervisor && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install PageKite
RUN curl -s https://pagekite.net/pk/ | bash
# Create a non privileged user to build the Rust code.
RUN useradd -m -d /home/user -p user user
RUN chown -R user /home/user
ARG db_type
ENV db_type ${db_type:-mysql}
COPY --chown=user:user . /home/user/registration_server/
USER user
WORKDIR /home/user/registration_server
RUN cargo build --release --features "${db_type}" && \
cargo install diesel_cli
USER root
ADD docker/init /
ADD docker/etc/cron.weekly/geoipupdate /etc/cron.weekly/
ADD docker/etc/supervisor/conf.d/supervisord.conf /etc/supervisor/conf.d/
RUN sed -i "s/{{db_type}}/${db_type}/" /init
ENTRYPOINT ["/init"]
# We expect to find the configuration directory mounted at /home/user/config
# with the following files:
# - config.toml : registration server configuration
# - pagekite.conf : PageKite configuration
# - pdns.conf : PowerDNS configuration
# - GeoIP.conf : (Optional) geoipupdate configuration