|
@ -1,7 +1,7 @@ |
|
|
### |
|
|
### |
|
|
### Build Variables |
|
|
### Build Variables |
|
|
### |
|
|
### |
|
|
FROM localhost/debian:latest |
|
|
FROM localhost/debian |
|
|
|
|
|
|
|
|
# deploy options |
|
|
# deploy options |
|
|
# -p (port) and -v (volume) both go host:container |
|
|
# -p (port) and -v (volume) both go host:container |
|
@ -28,7 +28,7 @@ ENV DBNAME=gitea |
|
|
### |
|
|
### |
|
|
|
|
|
|
|
|
# install packages we want |
|
|
# install packages we want |
|
|
RUN apt update -y && apt install -y postgresql postgresql-doc git openssh-server |
|
|
RUN apt update -y && apt install -y postgresql postgresql-doc git openssh-server cron |
|
|
|
|
|
|
|
|
# create directories for volumes |
|
|
# create directories for volumes |
|
|
RUN mkdir -p /vol/git /vol/data /vol/log /vol/keys |
|
|
RUN mkdir -p /vol/git /vol/data /vol/log /vol/keys |
|
@ -75,39 +75,53 @@ RUN mv pg_hba.conf /etc/postgresql/${PSQLV:?}/main/pg_hba.conf |
|
|
### Gitea |
|
|
### Gitea |
|
|
### |
|
|
### |
|
|
|
|
|
|
|
|
# Install templating engine |
|
|
|
|
|
RUN wget https://raw.githubusercontent.com/jirutka/esh/master/esh && \ |
|
|
|
|
|
chmod +x esh && \ |
|
|
|
|
|
mkdir -p /usr/local/lib/esh && \ |
|
|
|
|
|
mv esh /usr/local/lib/esh |
|
|
|
|
|
|
|
|
|
|
|
# dowload gitea |
|
|
# dowload gitea |
|
|
RUN wget https://dl.gitea.io/gitea/${GITEAV:?}/gitea-${GITEAV:?}-linux-amd64 && \ |
|
|
RUN wget --progress=dot:giga https://dl.gitea.io/gitea/${GITEAV:?}/gitea-${GITEAV:?}-linux-amd64 && \ |
|
|
mv gitea-${GITEAV:?}-linux-amd64 /usr/local/bin/gitea && \ |
|
|
mv gitea-${GITEAV:?}-linux-amd64 /usr/local/bin/gitea && \ |
|
|
chmod +x /usr/local/bin/gitea |
|
|
chmod +x /usr/local/bin/gitea |
|
|
|
|
|
|
|
|
# make directories gitea needs |
|
|
# make directories gitea needs |
|
|
RUN mkdir -p /var/lib/gitea/data/ /var/log/gitea /etc/gitea && \ |
|
|
RUN mkdir -p /vol/data/gitea /var/log/gitea /etc/gitea && \ |
|
|
chown -R gitea:gitea /var/lib/gitea /var/log/gitea && \ |
|
|
chown -R gitea:gitea /var/lib/gitea /var/log/gitea && \ |
|
|
chmod -R 750 /var/lib/gitea /var/log/gitea && \ |
|
|
chmod -R 750 /var/lib/gitea /var/log/gitea /vol/data/gitea && \ |
|
|
ln -s /var/log/gitea /var/lib/gitea/log && \ |
|
|
ln -s /var/log/gitea /var/lib/gitea/log && \ |
|
|
ln -s /vol/data/custom /var/lib/gitea/custom |
|
|
ln -s /vol/data/custom /var/lib/gitea/custom && \ |
|
|
|
|
|
ln -s /vol/data/gitea /var/lib/gitea/data |
|
|
|
|
|
|
|
|
# template config file |
|
|
# copy config file |
|
|
COPY assets/app.ini.esh.esh /etc/gitea/ |
|
|
COPY assets/app.config.ini /etc/gitea/ |
|
|
RUN cd /etc/gitea && \ |
|
|
|
|
|
esh app.ini.esh.esh && \ |
|
|
|
|
|
rm app.ini.esh.esh && \ |
|
|
|
|
|
chmod -R +r /etc/gitea |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# copy gitea service |
|
|
COPY assets/gitea.service /etc/systemd/system/ |
|
|
COPY assets/gitea.service /etc/systemd/system/ |
|
|
|
|
|
|
|
|
# make alias for running admin commands from command line easily |
|
|
# make alias for running admin commands from command line easily |
|
|
RUN echo "alias gitea='sudo -u gitea gitea --config /etc/gitea/app.ini'" >> /root/.bashrc |
|
|
RUN echo "alias gitea='sudo -u gitea gitea --config /etc/gitea/app.ini'" >> /root/.bashrc |
|
|
|
|
|
|
|
|
|
|
|
### |
|
|
|
|
|
### Data |
|
|
|
|
|
### |
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /vol/data |
|
|
|
|
|
|
|
|
|
|
|
# copy config files |
|
|
|
|
|
COPY data/ /vol/data/ |
|
|
|
|
|
# template secrets file to generate secrets |
|
|
|
|
|
RUN eval "echo \"$(cat app.secret.ini)\"" > app.secret.ini |
|
|
|
|
|
|
|
|
|
|
|
### |
|
|
|
|
|
### DB Auto Load/Dump |
|
|
|
|
|
### |
|
|
|
|
|
|
|
|
|
|
|
# copy service |
|
|
|
|
|
COPY assets/db-updown.service /etc/systemd/system/ |
|
|
|
|
|
|
|
|
|
|
|
# enable service |
|
|
|
|
|
RUN systemctl enable db-updown.service |
|
|
|
|
|
|
|
|
### |
|
|
### |
|
|
### Crontab |
|
|
### Crontab |
|
|
### |
|
|
### |
|
|
|
|
|
|
|
|
COPY assets/crontab /root/ |
|
|
COPY assets/crontab /root/ |
|
|
RUN crontab -u gitea /root/crontab |
|
|
RUN crontab -u gitea /root/crontab |
|
|
|
|
|
|
|
@ -116,5 +130,5 @@ RUN crontab -u gitea /root/crontab |
|
|
### |
|
|
### |
|
|
|
|
|
|
|
|
# bugfix for cron |
|
|
# bugfix for cron |
|
|
COPY bugfix/cronfix /root/ |
|
|
COPY assets/bugfix/cronfix /root/ |
|
|
RUN chmod +x /root/cronfix && /root/cronfix |
|
|
RUN chmod +x /root/cronfix && /root/cronfix |
|
|