build files for making podman containers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

92 lines
2.2 KiB

###
### Build Variables
###
FROM localhost/debian:latest
# deploy options
# -p (port) and -v (volume) both go host:container
LABEL deployopts="\
-p 9081:80 \
-p 9022:22 \
-v /tank/files/git:/vol/git \
-v /tank/files/db/gitea:/vol/db"
# make sure mount directories exist
RUN mkdir -p /vol/git /vol/db
# Build variables
# version of Gitea
# see the Gitea github page to determine the latest stable release
ARG giteav=1.11.5
# version of postgres
ARG psqlv=11
# uid that the files owner user should have
ARG FILESUID=5000
# Container Variables
# database name and user
ENV DBUSER=gtadmin
ENV DBNAME=gitea
# put environment variables in /etc/environment so we can access them from cron scripts
RUN echo "DBUSER=$DBUSER" >> /etc/environment && \
echo "DBNAME=$DBNAME" >> /etc/environment
###
### General Setup
###
# install packages we want
RUN apt update -y && apt install -y postgresql postgresql-doc git
# create gitea user with file owner UID
RUN addgroup --gid $FILESUID gitea && \
adduser gitea --ingroup gitea --uid $FILESUID --disabled-password --gecos "Gitea Server" --shell /usr/sbin/nologin --home /var/lib/gitea
# copy our custom scripts
COPY assets/bin/ /usr/local/bin/
###
### PostgreSQL ###
###
# configure PostgreSQL access
COPY --chown=postgres:postgres assets/pg_hba.conf /etc/postgresql/${psqlv}/main/pg_hba.conf
###
### Gitea
###
# dowload gitea
RUN wget https://dl.gitea.io/gitea/${giteav}/gitea-${giteav}-linux-amd64 && \
mv gitea /usr/local/bin/gitea && \
chmod +x /usr/local/bin/gitea
# make directories gitea needs
RUN mkdir -p /var/lib/gitea/ && \
cd /var/lib/gitea/ && \
mkdir custom data log && \
chown -R gitea:gitea /var/lib/gitea/ && \
chmod -R 750 /var/lib/gitea/
# copy gitea config template
COPY assets/app.ini.esh /etc/gitea/
# template config file
RUN cd /etc/gitea/ && \
esh app.ini.esh > app.ini && \
rm app.ini.esh && \
chmod -R +r /etc/gitea/
COPY assets/gitea.service /etc/systemd/system/
###
### Crontab
###
COPY assets/crontab /root/
RUN crontab -u gitea /root/crontab
###
### Bugfix
###
# execute command to workaround bug in cron
COPY bugfix/cronfix /root/
RUN chmod +x /root/cronfix && /root/cronfix