tokarchuk/v1.17
parent
6712aa21fa
commit
54b8172a24
@ -1,17 +0,0 @@ |
||||
FROM google/golang:latest |
||||
|
||||
ENV TAGS="sqlite redis memcache cert" USER="git" HOME="/home/git" |
||||
|
||||
COPY . /gopath/src/github.com/gogits/gogs/ |
||||
WORKDIR /gopath/src/github.com/gogits/gogs/ |
||||
|
||||
RUN go get -v -tags="$TAGS" github.com/gogits/gogs \ |
||||
&& go build -tags="$TAGS" \ |
||||
&& useradd -d $HOME -m $USER \ |
||||
&& chown -R $USER . |
||||
|
||||
USER $USER |
||||
|
||||
ENTRYPOINT [ "./gogs" ] |
||||
|
||||
CMD [ "web" ] |
@ -0,0 +1,54 @@ |
||||
FROM debian:wheezy-backports |
||||
#FROM google/golang:latest |
||||
#RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list |
||||
RUN apt-get update |
||||
RUN apt-get install -y gcc libc6-dev make --no-install-recommends |
||||
|
||||
# install golang |
||||
ENV GOLANG_VERSION 1.4.3 |
||||
RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ |
||||
| tar -v -C /usr/src -xz |
||||
RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1 |
||||
ENV PATH /usr/src/go/bin:$PATH |
||||
ENV GOPATH /gopath |
||||
|
||||
ENV TAGS="sqlite redis memcache cert" |
||||
COPY . /gopath/src/github.com/gogits/gogs/ |
||||
|
||||
#RUN apt-cache search openssh-server |
||||
RUN apt-get install -y openssh-server rsync |
||||
##RUN echo "deb http://ftp.debian.org/debian/ wheezy-backports main" >> /etc/apt/sources.list \ |
||||
# && apt-get update \ |
||||
# && apt-get install -y -t wheezy-backports openssh-server rsync |
||||
|
||||
|
||||
# set the working directory and add current stuff |
||||
WORKDIR /gopath/src/github.com/gogits/gogs/ |
||||
RUN go get -v -tags "$TAGS" |
||||
RUN go build -tags "$TAGS" |
||||
|
||||
RUN useradd --shell /bin/bash --system --comment gogits git |
||||
|
||||
RUN mkdir /var/run/sshd |
||||
# SSH login fix. Otherwise user is kicked off after login |
||||
RUN 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 |
||||
RUN echo "export VISIBLE=now" >> /etc/profile |
||||
RUN echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config |
||||
|
||||
# setup server keys on startup |
||||
RUN sed 's@^HostKey@\#HostKey@' -i /etc/ssh/sshd_config |
||||
RUN echo "HostKey /data/ssh/ssh_host_key" >> /etc/ssh/sshd_config |
||||
RUN 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 |
||||
RUN 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 |
||||
|
||||
# prepare data |
||||
#ENV USER="git" HOME="/home/git" |
||||
ENV GOGS_CUSTOM /data/gogs |
||||
RUN echo "export GOGS_CUSTOM=/data/gogs" >> /etc/profile |
||||
|
||||
EXPOSE 22 3000 |
||||
ENTRYPOINT [] |
||||
CMD ["./docker/start.sh"] |
@ -1,72 +0,0 @@ |
||||
#!/bin/bash |
||||
|
||||
blocks_dir=blocks |
||||
docker_dir=docker |
||||
template_dir=templates |
||||
|
||||
docker_file=Dockerfile |
||||
|
||||
gogs_config_file=conf.tmp |
||||
gogs_config=config |
||||
gogs_init_file=$docker_dir/init_gogs.sh |
||||
|
||||
compose_file=docker-compose.yml |
||||
compose_config=docker-compose |
||||
|
||||
gogs_init_template=$template_dir/init_gogs.sh.tpl |
||||
|
||||
if [ "$#" == 0 ]; then |
||||
blocks=`ls $blocks_dir` |
||||
if [ -z "$blocks" ]; then |
||||
echo "No Blocks available in $blocks_dir" |
||||
else |
||||
echo "Available Blocks:" |
||||
for block in $blocks; do |
||||
echo " $block" |
||||
done |
||||
fi |
||||
exit 0 |
||||
fi |
||||
|
||||
for file in $gogs_config_file $compose_file; do |
||||
if [ -e $file ]; then |
||||
echo "Deleting $file" |
||||
rm $file |
||||
fi |
||||
done |
||||
|
||||
for dir in $@; do |
||||
current_dir=$blocks_dir/$dir |
||||
if [ ! -d "$current_dir" ]; then |
||||
echo "$current_dir is not a directory" |
||||
exit 1 |
||||
fi |
||||
|
||||
if [ -e $current_dir/$docker_file ]; then |
||||
echo "Copying $current_dir/$docker_file to $docker_dir/$docker_file" |
||||
cp $current_dir/$docker_file $docker_dir/$docker_file |
||||
fi |
||||
|
||||
if [ -e $current_dir/$gogs_config ]; then |
||||
echo "Adding $current_dir/$gogs_config to $gogs_config_file" |
||||
cat $current_dir/$gogs_config >> $gogs_config_file |
||||
echo "" >> $gogs_config_file |
||||
fi |
||||
|
||||
if [ -e $current_dir/$compose_config ]; then |
||||
echo "Adding $current_dir/$compose_config to $compose_file" |
||||
cat $current_dir/$compose_config >> $compose_file |
||||
echo "" >> $compose_file |
||||
fi |
||||
done |
||||
|
||||
echo "Creating $gogs_init_file" |
||||
sed "/{{ CONFIG }}/{ |
||||
r $gogs_config_file |
||||
d |
||||
}" $gogs_init_template > $gogs_init_file |
||||
|
||||
if [ -e $gogs_config_file ]; then |
||||
echo "Removing temporary GoGS config" |
||||
rm $gogs_config_file |
||||
fi |
@ -1,49 +0,0 @@ |
||||
FROM buildpack-deps:trusty-scm |
||||
|
||||
# This part is taken from the official docker image -------------------- |
||||
|
||||
RUN apt-get update && apt-get install -y \ |
||||
build-essential --no-install-recommends |
||||
|
||||
ENV GOLANG_VERSION 1.3 |
||||
|
||||
RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ |
||||
| tar -v -C /usr/src -xz |
||||
|
||||
RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1 |
||||
|
||||
ENV PATH /usr/src/go/bin:$PATH |
||||
|
||||
RUN mkdir -p /go/src /go/bin && chmod -R 777 /go |
||||
ENV GOPATH /go |
||||
ENV PATH /go/bin:$PATH |
||||
WORKDIR /go |
||||
|
||||
# ---------------------------------------------------------------------- |
||||
|
||||
|
||||
RUN useradd -m git |
||||
|
||||
ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs |
||||
ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf |
||||
ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini |
||||
|
||||
RUN go get -u -d github.com/gogits/gogs |
||||
# WORKDIR $GOGS_PATH |
||||
WORKDIR /go/src/github.com/gogits/gogs |
||||
RUN go build github.com/gogits/gogs |
||||
RUN chown -R git $GOGS_PATH |
||||
|
||||
ADD init_gogs.sh /tmp/ |
||||
RUN chown git /tmp/init_gogs.sh |
||||
RUN chmod +x /tmp/init_gogs.sh |
||||
|
||||
USER git |
||||
ENV HOME /home/git |
||||
ENV USER git |
||||
ENV PATH $GOGS_PATH:$PATH |
||||
|
||||
RUN git config --global user.name "GoGS" && git config --global user.email "gogitservice@gmail.com" |
||||
|
||||
ENTRYPOINT ["/tmp/init_gogs.sh"] |
||||
CMD ["gogs", "web"] |
@ -1,49 +0,0 @@ |
||||
FROM buildpack-deps:trusty-scm |
||||
|
||||
# This part is taken from the official docker image -------------------- |
||||
|
||||
RUN apt-get update && apt-get install -y \ |
||||
build-essential --no-install-recommends |
||||
|
||||
ENV GOLANG_VERSION 1.3 |
||||
|
||||
RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ |
||||
| tar -v -C /usr/src -xz |
||||
|
||||
RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1 |
||||
|
||||
ENV PATH /usr/src/go/bin:$PATH |
||||
|
||||
RUN mkdir -p /go/src /go/bin && chmod -R 777 /go |
||||
ENV GOPATH /go |
||||
ENV PATH /go/bin:$PATH |
||||
WORKDIR /go |
||||
|
||||
# ---------------------------------------------------------------------- |
||||
|
||||
|
||||
RUN useradd -m git |
||||
|
||||
ENV GOGS_PATH $GOPATH/src/github.com/gogits/gogs |
||||
ENV GOGS_CUSTOM_CONF_PATH $GOGS_PATH/custom/conf |
||||
ENV GOGS_CUSTOM_CONF $GOGS_CUSTOM_CONF_PATH/app.ini |
||||
|
||||
RUN git clone -b dev https://github.com/gogits/gogs.git $GOGS_PATH |
||||
# WORKDIR $GOGS_PATH |
||||
WORKDIR /go/src/github.com/gogits/gogs |
||||
RUN go get -d && go build |
||||
RUN chown -R git $GOGS_PATH |
||||
|
||||
ADD init_gogs.sh /tmp/ |
||||
RUN chown git /tmp/init_gogs.sh |
||||
RUN chmod +x /tmp/init_gogs.sh |
||||
|
||||
USER git |
||||
ENV HOME /home/git |
||||
ENV USER git |
||||
ENV PATH $GOGS_PATH:$PATH |
||||
|
||||
RUN git config --global user.name "GoGS" && git config --global user.email "gogitservice@gmail.com" |
||||
|
||||
ENTRYPOINT ["/tmp/init_gogs.sh"] |
||||
CMD ["gogs", "web"] |
@ -1,3 +0,0 @@ |
||||
[cache] |
||||
DB_TYPE = memcache |
||||
HOST = HOST = ${CACHE_1_PORT_11211_TCP_ADDR}:${CACHE_1_PORT_11211_TCP_PORT} |
@ -1,2 +0,0 @@ |
||||
cache: |
||||
image: sylvainlasnier/memcached:latest |
@ -1,3 +0,0 @@ |
||||
[cache] |
||||
DB_TYPE = redis |
||||
HOST = ${CACHE_1_PORT_6379_TCP_ADDR}:${CACHE_1_PORT_6379_TCP_PORT} |
@ -1,2 +0,0 @@ |
||||
cache: |
||||
image: redis:latest |
@ -1,6 +0,0 @@ |
||||
[database] |
||||
DB_TYPE = mysql |
||||
HOST = ${DB_1_PORT_3306_TCP_ADDR}:${DB_1_PORT_3306_TCP_PORT} |
||||
NAME = ${DB_1_ENV_MYSQL_DATABASE} |
||||
USER = ${DB_1_ENV_MYSQL_USER} |
||||
PASSWD = ${DB_1_ENV_MYSQL_PASSWORD} |
@ -1,7 +0,0 @@ |
||||
db: |
||||
image: mysql:latest |
||||
environment: |
||||
MYSQL_ROOT_PASSWORD: rootpass |
||||
MYSQL_DATABASE: gogs |
||||
MYSQL_USER: gogs |
||||
MYSQL_PASSWORD: password |
@ -1,6 +0,0 @@ |
||||
[database] |
||||
DB_TYPE = postgres |
||||
HOST = ${DB_1_PORT_5432_TCP_ADDR}:${DB_1_PORT_5432_TCP_PORT} |
||||
NAME = ${DB_1_ENV_POSTGRESQL_DB} |
||||
USER = ${DB_1_ENV_POSTGRESQL_USER} |
||||
PASSWD = ${DB_1_ENV_POSTGRESQL_PASS} |
@ -1,6 +0,0 @@ |
||||
db: |
||||
image: wyaeld/postgres:9.3 |
||||
environment: |
||||
POSTGRESQL_DB: gogs |
||||
POSTGRESQL_USER: gogs |
||||
POSTGRESQL_PASS: password |
@ -1,3 +0,0 @@ |
||||
[session] |
||||
PROVIDER = mysql |
||||
PROVIDER_CONFIG = ${SESSION_1_ENV_MYSQL_USER}:${SESSION_1_ENV_MYSQL_PASSWORD}@SESSION_1_PORT_3306_TCP_PROTO(${SESSION_1_PORT_3306_TCP_ADDR}:${SESSION_1_PORT_3306_TCP_PORT})/${SESSION_1_ENV_MYSQL_DATABASE} |
@ -1,7 +0,0 @@ |
||||
session: |
||||
image: mysql:latest |
||||
environment: |
||||
MYSQL_ROOT_PASSWORD: rootpass |
||||
MYSQL_DATABASE: gogs_session |
||||
MYSQL_USER: gogs |
||||
MYSQL_PASSWORD: password |
@ -1,6 +0,0 @@ |
||||
gogs: |
||||
build: docker |
||||
links: |
||||
- cache |
||||
ports: |
||||
- "3000:3000" |
@ -1,7 +0,0 @@ |
||||
gogs: |
||||
build: docker |
||||
links: |
||||
- cache |
||||
- session |
||||
ports: |
||||
- "3000:3000" |
@ -1,6 +0,0 @@ |
||||
gogs: |
||||
build: docker |
||||
links: |
||||
- db |
||||
ports: |
||||
- "3000:3000" |
@ -1,7 +0,0 @@ |
||||
gogs: |
||||
build: docker |
||||
links: |
||||
- db |
||||
- cache |
||||
ports: |
||||
- "3000:3000" |
@ -1,8 +0,0 @@ |
||||
gogs: |
||||
build: docker |
||||
links: |
||||
- db |
||||
- cache |
||||
- session |
||||
ports: |
||||
- "3000:3000" |
@ -1,7 +0,0 @@ |
||||
gogs: |
||||
build: docker |
||||
links: |
||||
- db |
||||
- session |
||||
ports: |
||||
- "3000:3000" |
@ -1,4 +0,0 @@ |
||||
gogs: |
||||
build: docker |
||||
ports: |
||||
- "3000:3000" |
@ -1,6 +0,0 @@ |
||||
gogs: |
||||
build: docker |
||||
links: |
||||
- session |
||||
ports: |
||||
- "3000:3000" |
@ -0,0 +1,47 @@ |
||||
#!/bin/bash - |
||||
# |
||||
|
||||
if ! test -d /data/gogs |
||||
then |
||||
mkdir -p /var/run/sshd |
||||
mkdir -p /data/gogs/data /data/gogs/conf /data/gogs/log /data/git |
||||
fi |
||||
|
||||
if ! test -d /data/ssh |
||||
then |
||||
mkdir /data/ssh |
||||
ssh-keygen -q -f /data/ssh/ssh_host_key -N '' -t rsa1 |
||||
ssh-keygen -q -f /data/ssh/ssh_host_rsa_key -N '' -t rsa |
||||
ssh-keygen -q -f /data/ssh/ssh_host_dsa_key -N '' -t dsa |
||||
ssh-keygen -q -f /data/ssh/ssh_host_ecdsa_key -N '' -t ecdsa |
||||
ssh-keygen -q -f /data/ssh/ssh_host_ed25519_key -N '' -t ed25519 |
||||
chown -R root:root /data/ssh/* |
||||
chmod 600 /data/ssh/* |
||||
fi |
||||
|
||||
service ssh start |
||||
|
||||
# sync templates |
||||
test -d /data/gogs/templates || cp -ar ./templates /data/gogs/ |
||||
rsync -rtv /data/gogs/templates/ ./templates/ |
||||
|
||||
ln -sf /data/gogs/log ./log |
||||
ln -sf /data/gogs/data ./data |
||||
ln -sf /data/git /home/git |
||||
|
||||
|
||||
if ! test -d ~git/.ssh |
||||
then |
||||
mkdir ~git/.ssh |
||||
chmod 700 ~git/.ssh |
||||
fi |
||||
|
||||
if ! test -f ~git/.ssh/environment |
||||
then |
||||
echo "GOGS_CUSTOM=/data/gogs" > ~git/.ssh/environment |
||||
chown git:git ~git/.ssh/environment |
||||
chown 600 ~git/.ssh/environment |
||||
fi |
||||
|
||||
chown -R git:git /data . |
||||
exec su git -c "./gogs web" |
@ -1,12 +0,0 @@ |
||||
#!/bin/sh |
||||
|
||||
if [ ! -d "$GOGS_CUSTOM_CONF_PATH" ]; then |
||||
mkdir -p $GOGS_CUSTOM_CONF_PATH |
||||
|
||||
echo " |
||||
{{ CONFIG }} |
||||
" >> $GOGS_CUSTOM_CONF |
||||
|
||||
fi |
||||
|
||||
exec "$@" |
Loading…
Reference in new issue