alpine-gitea/Dockerfile

69 lines
1.5 KiB
Docker
Raw Normal View History

2018-06-05 13:33:09 +00:00
FROM alpine:3.7
2016-03-17 18:11:40 +00:00
MAINTAINER Julian Ospald <hasufell@posteo.de>
ENV GOPATH /gopath
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin
2018-06-06 15:01:22 +00:00
WORKDIR /gopath/src/code.gitea.io/gitea
2016-03-17 18:11:40 +00:00
2018-06-05 14:38:05 +00:00
RUN apk --no-cache add \
bash \
ca-certificates \
curl \
2018-06-06 15:01:22 +00:00
gettext \
2018-06-05 14:38:05 +00:00
git \
linux-pam \
openssh \
redis \
shadow \
socat \
sqlite \
sudo \
2018-06-06 15:01:22 +00:00
su-exec \
2018-06-05 14:38:05 +00:00
supervisor \
tzdata \
&& \
apk --no-cache add --virtual build-deps \
build-base \
linux-pam-dev \
2018-06-06 15:01:22 +00:00
go \
2018-06-05 14:38:05 +00:00
&& \
2018-06-06 15:01:22 +00:00
git clone --depth=1 https://github.com/go-gitea/gitea.git \
/gopath/src/code.gitea.io/gitea && \
TAGS="bindata sqlite pam" make generate build && \
2018-06-05 14:38:05 +00:00
apk del build-deps && \
2018-06-06 17:47:29 +00:00
mkdir -p /app/gitea && \
mv /gopath/src/code.gitea.io/gitea/gitea /app/gitea/gitea && \
2016-03-17 18:11:40 +00:00
rm -rf "$GOPATH" /var/cache/apk/*
2018-06-06 17:47:29 +00:00
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
2018-06-06 15:01:22 +00:00
ENV USER git
2016-03-17 18:11:40 +00:00
2018-06-06 15:01:22 +00:00
WORKDIR /app/gitea/
2016-03-17 18:11:40 +00:00
2018-06-05 14:38:05 +00:00
# Setup ssh
COPY config/sshd_config /etc/ssh/sshd_config
2016-03-17 18:11:40 +00:00
2018-06-06 17:47:29 +00:00
# template config
COPY config/app.ini /etc/templates/app.ini
2016-03-17 18:11:40 +00:00
# Prepare data
2018-06-06 15:01:22 +00:00
ENV GITEA_CUSTOM /data/gitea
2018-06-06 16:08:40 +00:00
RUN echo "export GITEA_CUSTOM=/data/gitea" >> /etc/profile
2016-03-17 18:11:40 +00:00
2018-06-06 17:47:29 +00:00
# redis
2016-03-17 18:11:40 +00:00
RUN chown -R redis /var/log/redis
RUN sed -i -e 's/daemonize yes/daemonize no/' /etc/redis.conf
2018-06-06 17:47:29 +00:00
# supervisord and startup
2016-03-17 18:11:40 +00:00
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