mirror of https://github.com/gogits/gogs.git
Browse Source
- Updated to use Debian Jessie base image. - Less intermediate containers. - Uses supervisor to start process. - Fix #1717, #1708 and probably #1313.pull/1718/head
Óscar García Amor
9 years ago
3 changed files with 69 additions and 52 deletions
@ -1,54 +1,48 @@ |
|||||||
FROM google/debian:wheezy |
FROM debian:jessie |
||||||
MAINTAINER u@gogs.io |
MAINTAINER ogarcia@connectical.com |
||||||
|
|
||||||
RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list && \ |
# Update and install required packages |
||||||
apt-get update -qqy && \ |
RUN apt-get update -qqy && \ |
||||||
apt-get install --no-install-recommends -qqy \ |
apt-get install --no-install-recommends -qqy \ |
||||||
curl build-essential ca-certificates git \ |
build-essential ca-certificates curl git libpam-dev \ |
||||||
openssh-server libpam-dev && \ |
openssh-server supervisor && \ |
||||||
apt-get autoclean && \ |
apt-get autoclean && \ |
||||||
apt-get autoremove && \ |
apt-get autoremove && \ |
||||||
rm -rf /var/lib/apt/lists/* |
rm -rf /var/lib/apt/lists/* |
||||||
|
|
||||||
ENV GOROOT /goroot |
|
||||||
ENV GOPATH /gopath |
|
||||||
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin |
|
||||||
|
|
||||||
COPY . /gopath/src/github.com/gogits/gogs/ |
|
||||||
WORKDIR /gopath/src/github.com/gogits/gogs/ |
|
||||||
|
|
||||||
# Build binary and clean up useless files |
# Build binary and clean up useless files |
||||||
RUN mkdir /goroot && \ |
RUN mkdir -p /app /goroot /gopath/src/github.com/gogits && \ |
||||||
curl https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz | tar xzf - -C /goroot --strip-components=1 && \ |
curl https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz | tar xzf - -C /goroot --strip-components=1 && \ |
||||||
|
git clone https://github.com/gogits/gogs.git \ |
||||||
|
/gopath/src/github.com/gogits/gogs && \ |
||||||
|
cd /gopath/src/github.com/gogits/gogs && \ |
||||||
|
GOROOT="/goroot" GOPATH="/gopath" PATH="$PATH:/goroot/bin:/gopath/bin" \ |
||||||
go get -v -tags "sqlite redis memcache cert pam" && \ |
go get -v -tags "sqlite redis memcache cert pam" && \ |
||||||
|
GOROOT="/goroot" GOPATH="/gopath" PATH="$PATH:/goroot/bin:/gopath/bin" \ |
||||||
go build -tags "sqlite redis memcache cert pam" && \ |
go build -tags "sqlite redis memcache cert pam" && \ |
||||||
mkdir /app/ && \ |
|
||||||
mv /gopath/src/github.com/gogits/gogs/ /app/gogs/ && \ |
mv /gopath/src/github.com/gogits/gogs/ /app/gogs/ && \ |
||||||
rm -r $GOROOT $GOPATH |
rm -r /goroot /gopath |
||||||
|
|
||||||
WORKDIR /app/gogs/ |
|
||||||
|
|
||||||
RUN useradd --shell /bin/bash --system --comment gogits git |
|
||||||
|
|
||||||
# SSH login fix, otherwise user is kicked off after login |
# Create user, fix and setup SSH and prepare data |
||||||
RUN mkdir /var/run/sshd && \ |
RUN useradd --shell /bin/bash --system --comment gogits git && \ |
||||||
|
mkdir /var/run/sshd && \ |
||||||
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd && \ |
sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd && \ |
||||||
sed 's@UsePrivilegeSeparation yes@UsePrivilegeSeparation no@' -i /etc/ssh/sshd_config && \ |
sed 's@UsePrivilegeSeparation yes@UsePrivilegeSeparation no@' -i /etc/ssh/sshd_config && \ |
||||||
echo "export VISIBLE=now" >> /etc/profile && \ |
echo "export VISIBLE=now" >> /etc/profile && \ |
||||||
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config |
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config && \ |
||||||
|
sed 's@^HostKey@\#HostKey@' -i /etc/ssh/sshd_config && \ |
||||||
# Setup server keys on startup |
|
||||||
RUN sed 's@^HostKey@\#HostKey@' -i /etc/ssh/sshd_config && \ |
|
||||||
echo "HostKey /data/ssh/ssh_host_key" >> /etc/ssh/sshd_config && \ |
echo "HostKey /data/ssh/ssh_host_key" >> /etc/ssh/sshd_config && \ |
||||||
echo "HostKey /data/ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config && \ |
echo "HostKey /data/ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config && \ |
||||||
echo "HostKey /data/ssh/ssh_host_dsa_key" >> /etc/ssh/sshd_config && \ |
echo "HostKey /data/ssh/ssh_host_dsa_key" >> /etc/ssh/sshd_config && \ |
||||||
echo "HostKey /data/ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config && \ |
echo "HostKey /data/ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config && \ |
||||||
echo "HostKey /data/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config |
echo "HostKey /data/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config && \ |
||||||
|
echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile |
||||||
|
|
||||||
|
WORKDIR /app/gogs |
||||||
|
|
||||||
# Prepare data |
|
||||||
ENV GOGS_CUSTOM /data/gogs |
ENV GOGS_CUSTOM /data/gogs |
||||||
RUN echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile |
|
||||||
|
|
||||||
EXPOSE 22 3000 |
EXPOSE 22 3000 |
||||||
ENTRYPOINT [] |
VOLUME ["/data"] |
||||||
|
|
||||||
CMD ["./docker/start.sh"] |
CMD ["./docker/start.sh"] |
@ -0,0 +1,26 @@ |
|||||||
|
[supervisord] |
||||||
|
logfile=/data/gogs/log/s_supervisor.log |
||||||
|
loglevel=info |
||||||
|
nodaemon=true |
||||||
|
|
||||||
|
[program:gogs] |
||||||
|
command=/app/gogs/gogs web |
||||||
|
process_name:%(program_name)s |
||||||
|
numprocs=1 |
||||||
|
user=git |
||||||
|
autostart=true |
||||||
|
autorestart=true |
||||||
|
stopsignal=TERM |
||||||
|
redirect_stderr=true |
||||||
|
stdout_logfile=/data/gogs/log/s_%(program_name)s.%(process_num)02d.log |
||||||
|
environment=HOME="/home/git",USER=git |
||||||
|
|
||||||
|
[program:sshd] |
||||||
|
command=/usr/sbin/sshd -D -e |
||||||
|
process_name:%(program_name)s |
||||||
|
numprocs=1 |
||||||
|
autostart=true |
||||||
|
autorestart=true |
||||||
|
stopsignal=TERM |
||||||
|
redirect_stderr=true |
||||||
|
stdout_logfile=/data/gogs/log/s_%(program_name)s.%(process_num)02d.log |
Loading…
Reference in new issue