alpine-gitea/Dockerfile

69 lines
1.5 KiB
Docker

FROM alpine:3.7
MAINTAINER Julian Ospald <hasufell@posteo.de>
ENV GOPATH /gopath
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin
WORKDIR /gopath/src/code.gitea.io/gitea
RUN apk --no-cache add \
bash \
ca-certificates \
curl \
gettext \
git \
linux-pam \
openssh \
redis \
shadow \
socat \
sqlite \
sudo \
su-exec \
supervisor \
tzdata \
&& \
apk --no-cache add --virtual build-deps \
build-base \
linux-pam-dev \
go \
&& \
git clone --depth=1 https://github.com/go-gitea/gitea.git \
/gopath/src/code.gitea.io/gitea && \
TAGS="bindata sqlite pam" make generate build && \
apk del build-deps && \
mkdir -p /app/gitea && \
mv /gopath/src/code.gitea.io/gitea/gitea /app/gitea/gitea && \
rm -rf "$GOPATH" /var/cache/apk/*
RUN addgroup -S -g 1000 git
RUN adduser -G git -S -H -D -g 'Gogs Git User' -h /data/git -s /bin/bash -u 1000 git && \
echo "git:$(dd if=/dev/urandom bs=24 count=1 status=none | base64)" | chpasswd
ENV USER git
WORKDIR /app/gitea/
# Setup ssh
COPY config/sshd_config /etc/ssh/sshd_config
# template config
COPY config/app.ini /etc/templates/app.ini
# Prepare data
ENV GITEA_CUSTOM /data/gitea
RUN echo "export GITEA_CUSTOM=/data/gitea" >> /etc/profile
# redis
RUN chown -R redis /var/log/redis
RUN sed -i -e 's/daemonize yes/daemonize no/' /etc/redis.conf
# supervisord and startup
COPY setup.sh /setup.sh
RUN chmod +x /setup.sh
COPY config/supervisord.conf /etc/supervisord.conf
EXPOSE 3000
CMD /setup.sh && exec /usr/bin/supervisord -n -c /etc/supervisord.conf