mirror of
https://github.com/go-gitea/gitea
synced 2024-11-10 20:24:24 +00:00
#1521 reduce Docker image size
This commit is contained in:
parent
c256fc4438
commit
be90ea583a
12
.dockerignore
Normal file
12
.dockerignore
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
.git/*
|
||||||
|
conf/*
|
||||||
|
packager/*
|
||||||
|
scripts/*
|
||||||
|
*.yml
|
||||||
|
*.md
|
||||||
|
.bra.toml
|
||||||
|
.editorconfig
|
||||||
|
.gitignore
|
||||||
|
.gopmfile
|
||||||
|
config.codekit
|
||||||
|
LICENSE
|
61
Dockerfile
61
Dockerfile
@ -1,36 +1,51 @@
|
|||||||
FROM google/golang:latest
|
FROM google/debian:wheezy
|
||||||
MAINTAINER codeskyblue@gmail.com
|
MAINTAINER u@gogs.io
|
||||||
|
|
||||||
RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list
|
RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list && \
|
||||||
RUN apt-get update
|
apt-get update -qqy && \
|
||||||
RUN apt-get install -y openssh-server rsync libpam-dev
|
apt-get install --no-install-recommends -qqy \
|
||||||
|
curl build-essential ca-certificates git \
|
||||||
|
openssh-server rsync libpam-dev && \
|
||||||
|
apt-get autoclean && \
|
||||||
|
apt-get autoremove && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
ENV GOROOT /goroot
|
||||||
|
ENV GOPATH /gopath
|
||||||
|
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin
|
||||||
|
|
||||||
# set the working directory and add current stuff
|
|
||||||
COPY . /gopath/src/github.com/gogits/gogs/
|
COPY . /gopath/src/github.com/gogits/gogs/
|
||||||
WORKDIR /gopath/src/github.com/gogits/gogs/
|
WORKDIR /gopath/src/github.com/gogits/gogs/
|
||||||
|
|
||||||
RUN go get -v -tags "sqlite redis memcache cert pam"
|
# Build binary and clean up useless files
|
||||||
RUN go build -tags "sqlite redis memcache cert pam"
|
RUN mkdir /goroot && \
|
||||||
|
curl https://storage.googleapis.com/golang/go1.5.linux-amd64.tar.gz | tar xzf - -C /goroot --strip-components=1 && \
|
||||||
|
go get -v -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/ && \
|
||||||
|
rm -r $GOROOT $GOPATH
|
||||||
|
|
||||||
|
WORKDIR /app/gogs/
|
||||||
|
|
||||||
RUN useradd --shell /bin/bash --system --comment gogits git
|
RUN useradd --shell /bin/bash --system --comment gogits git
|
||||||
|
|
||||||
RUN mkdir /var/run/sshd
|
# SSH login fix, otherwise user is kicked off after login
|
||||||
# SSH login fix. Otherwise user is kicked off after login
|
RUN mkdir /var/run/sshd && \
|
||||||
RUN 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 && \
|
||||||
RUN sed 's@UsePrivilegeSeparation yes@UsePrivilegeSeparation no@' -i /etc/ssh/sshd_config
|
sed 's@UsePrivilegeSeparation yes@UsePrivilegeSeparation no@' -i /etc/ssh/sshd_config && \
|
||||||
RUN echo "export VISIBLE=now" >> /etc/profile
|
echo "export VISIBLE=now" >> /etc/profile && \
|
||||||
RUN echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
|
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
|
||||||
|
|
||||||
# setup server keys on startup
|
# Setup server keys on startup
|
||||||
RUN sed 's@^HostKey@\#HostKey@' -i /etc/ssh/sshd_config
|
RUN sed 's@^HostKey@\#HostKey@' -i /etc/ssh/sshd_config && \
|
||||||
RUN echo "HostKey /data/ssh/ssh_host_key" >> /etc/ssh/sshd_config
|
echo "HostKey /data/ssh/ssh_host_key" >> /etc/ssh/sshd_config && \
|
||||||
RUN echo "HostKey /data/ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config
|
echo "HostKey /data/ssh/ssh_host_rsa_key" >> /etc/ssh/sshd_config && \
|
||||||
RUN echo "HostKey /data/ssh/ssh_host_dsa_key" >> /etc/ssh/sshd_config
|
echo "HostKey /data/ssh/ssh_host_dsa_key" >> /etc/ssh/sshd_config && \
|
||||||
RUN echo "HostKey /data/ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config
|
echo "HostKey /data/ssh/ssh_host_ecdsa_key" >> /etc/ssh/sshd_config && \
|
||||||
RUN echo "HostKey /data/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config
|
echo "HostKey /data/ssh/ssh_host_ed25519_key" >> /etc/ssh/sshd_config
|
||||||
|
|
||||||
# prepare data
|
# Prepare data
|
||||||
#ENV USER="git" HOME="/home/git"
|
|
||||||
ENV GOGS_CUSTOM /data/gogs
|
ENV GOGS_CUSTOM /data/gogs
|
||||||
RUN echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile
|
RUN echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ img.avatar-100 {
|
|||||||
height: 59px;
|
height: 59px;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
width: 120%;
|
width: 170%;
|
||||||
min-width: 140px;
|
min-width: 140px;
|
||||||
}
|
}
|
||||||
#footer-lang .drop-down li > a {
|
#footer-lang .drop-down li > a {
|
||||||
|
Loading…
Reference in New Issue
Block a user