docker-alpine-gogs/Dockerfile

65 lines
1.5 KiB
Docker
Raw Permalink 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-05 13:33:09 +00:00
WORKDIR /gopath/src/github.com/gogs/gogs/
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 \
git \
go \
linux-pam \
openssh \
redis \
shadow \
socat \
sqlite \
sudo \
supervisor \
tzdata \
&& \
apk --no-cache add --virtual build-deps \
build-base \
linux-pam-dev \
&& \
2018-06-05 13:33:09 +00:00
git clone --depth=1 https://github.com/gogs/gogs.git \
/gopath/src/github.com/gogs/gogs && \
2018-06-05 14:38:05 +00:00
make build TAGS="sqlite redis memcache cert pam" && \
apk del build-deps && \
2016-03-17 18:11:40 +00:00
mkdir /app/ && \
2018-06-05 13:33:09 +00:00
mv /gopath/src/github.com/gogs/gogs/ /app/gogs/ && \
2016-03-17 18:11:40 +00:00
rm -rf "$GOPATH" /var/cache/apk/*
2018-06-05 14:46:18 +00:00
RUN addgroup -S git
2018-06-05 14:38:05 +00:00
RUN adduser -G git -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && \
usermod -p '*' git && passwd -u git
2016-03-17 18:11:40 +00:00
WORKDIR /app/gogs/
# SSH login fix, otherwise user is kicked off after login
RUN echo "export VISIBLE=now" >> /etc/profile && \
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
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
# Prepare data
ENV GOGS_CUSTOM /data/gogs
RUN echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile
RUN chown -R redis /var/log/redis
RUN sed -i -e 's/daemonize yes/daemonize no/' /etc/redis.conf
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