Quellcode durchsuchen

Initial commit

tags/v1.2.2
Piotr Orzechowski vor 2 Jahren
Commit
bf5b1c395a

+ 4
- 0
.dockerignore Datei anzeigen

@@ -0,0 +1,4 @@
build.sh
.git
hooks
README.md

+ 53
- 0
Dockerfile Datei anzeigen

@@ -0,0 +1,53 @@
ARG golang_version
ARG alpine_version
FROM "golang:${golang_version}-alpine${alpine_version}" as builder

RUN set -eu && apk --no-cache add \
gcc \
git \
make \
musl-dev

ENV GOPATH="/go"
ENV SRC_DIR="${GOPATH}/src/code.gitea.io/gitea"
WORKDIR "$SRC_DIR"

ARG gitea_repo_url
ARG gitea_version
RUN set -eu && git clone --branch "v${gitea_version}" --depth 1 "$gitea_repo_url" "$SRC_DIR"

ARG gitea_build_tags
RUN set -eu && TAGS="$gitea_build_tags" make generate build

ARG alpine_version
FROM "alpine:${alpine_version}"

LABEL maintainer="Piotr Orzechowski [orzechowski.tech]"

RUN set -eu && apk --no-cache add \
bash \
ca-certificates \
curl \
git \
linux-pam \
openssh \
s6 \
sqlite \
su-exec \
tzdata
RUN set -eu && addgroup -S -g 1000 git \
&& adduser -S -D -G git -u 1000 -s '/bin/bash' -H -h '/data/git' git
RUN set -eu && echo "root:$(head -c 32 /dev/urandom | base64)" | chpasswd \
&& echo "git:$(head -c 32 /dev/urandom | base64)" | chpasswd

COPY --from=builder "/go/src/code.gitea.io/gitea/gitea" "/usr/local/bin/gitea"
COPY files /

VOLUME ["/data"]

ENV GITEA_CUSTOM="/data/gitea"
ENV GODEBUG="netdns=go"

ENTRYPOINT ["/usr/local/bin/entrypoint"]

EXPOSE 22 3000

+ 1
- 0
README.md Datei anzeigen

@@ -0,0 +1 @@
Custom [Gitea](https://gitea.io) Docker image.

+ 19
- 0
build.sh Datei anzeigen

@@ -0,0 +1,19 @@
#!/bin/sh

set -eu

gitea_version='1.2.2'
gitea_build_tags='bindata sqlite'
gitea_repo_url='https://github.com/go-gitea/gitea.git'
golang_version='1.9'
alpine_version='3.6'
image_name='orzech/gitea'

docker build \
--build-arg gitea_version="$gitea_version" \
--build-arg gitea_build_tags="$gitea_build_tags" \
--build-arg gitea_repo_url="$gitea_repo_url" \
--build-arg golang_version="$golang_version" \
--build-arg alpine_version="$alpine_version" \
-t "${IMAGE_NAME:-${image_name}}" \
.

+ 47
- 0
files/etc/gitea/default.ini Datei anzeigen

@@ -0,0 +1,47 @@
RUN_MODE = prod

[repository]
ROOT = /data/git/repositories
PREFERRED_LICENSES = GPL-3.0,AGPL-3.0,LGPL-3.0

[repository.upload]
TEMP_PATH = /data/gitea/uploads

[ui]
SHOW_USER_EMAIL = false

[server]
APP_DATA_PATH = /data/gitea
LANDING_PAGE = explore

[ssh.minimum_key_sizes]
ED25519 = 256
ECDSA = -1
RSA = -1
DSA = -1

[database]
DB_TYPE = sqlite3
PATH = /data/gitea/gitea.db

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

[service]
DEFAULT_KEEP_EMAIL_PRIVATE = true

[session]
PROVIDER_CONFIG = /data/gitea/sessions

[picture]
AVATAR_UPLOAD_PATH = /data/gitea/avatars

[attachment]
PATH = /data/gitea/attachments

[log]
ROOT_PATH = /data/gitea/log
LEVEL = Warn

[other]
SHOW_FOOTER_VERSION = false

+ 14
- 0
files/etc/nsswitch.conf Datei anzeigen

@@ -0,0 +1,14 @@
passwd: compat
group: compat
shadow: compat
gshadow: files

hosts: files dns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files

netgroup: nis

+ 1
- 0
files/etc/profile.d/gitea Datei anzeigen

@@ -0,0 +1 @@
export GITEA_CUSTOM='/data/gitea'

+ 2
- 0
files/etc/s6/.s6-svscan/finish Datei anzeigen

@@ -0,0 +1,2 @@
#!/bin/sh
exit 0

+ 2
- 0
files/etc/s6/gitea/finish Datei anzeigen

@@ -0,0 +1,2 @@
#!/bin/sh
exit 0

+ 27
- 0
files/etc/s6/gitea/run Datei anzeigen

@@ -0,0 +1,27 @@
#!/bin/sh

set -eu

umask 077

# setup

for directory in '/data/git' "$GITEA_CUSTOM" "${GITEA_CUSTOM}/conf" '/var/run/gitea'; do
if [ ! -d "$directory" ]; then
/bin/echo "Creating ${directory} directory"
/bin/mkdir "$directory"
/bin/chown git:git "$directory"
fi
done

if [ ! -f "${GITEA_CUSTOM}/conf/app.ini" ]; then
/bin/echo 'Copying default app.ini'
/bin/cp '/etc/gitea/default.ini' "${GITEA_CUSTOM}/conf/app.ini"
/bin/chown git:git "${GITEA_CUSTOM}/conf/app.ini"
fi

# run

export USER='git'

exec /sbin/su-exec git /usr/local/bin/gitea web --pid '/var/run/gitea/gitea.pid'

+ 2
- 0
files/etc/s6/openssh/finish Datei anzeigen

@@ -0,0 +1,2 @@
#!/bin/sh
exit 0

+ 20
- 0
files/etc/s6/openssh/run Datei anzeigen

@@ -0,0 +1,20 @@
#!/bin/sh

set -eu

# setup

if [ ! -d '/data/ssh' ]; then
/bin/echo 'Creating /data/ssh directory'
/bin/mkdir -m 0700 '/data/ssh'
fi

if [ ! -f '/data/ssh/ssh_host_ed25519_key' ]; then
/bin/echo 'Generating server key'
/usr/bin/ssh-keygen -t ed25519 -f '/data/ssh/ssh_host_ed25519_key' -N '' > /dev/null
/bin/chmod 0600 '/data/ssh/ssh_host_ed25519_key'
fi

# run

exec /usr/sbin/sshd -D

+ 2
- 0
files/etc/s6/syslogd/finish Datei anzeigen

@@ -0,0 +1,2 @@
#!/bin/sh
exit 0

+ 7
- 0
files/etc/s6/syslogd/run Datei anzeigen

@@ -0,0 +1,7 @@
#!/bin/sh

set -eu

# run

exec /sbin/syslogd -nS -O -

+ 39
- 0
files/etc/ssh/sshd_config Datei anzeigen

@@ -0,0 +1,39 @@
Port 22
AddressFamily any
ListenAddress 0.0.0.0
ListenAddress ::

Protocol 2

HostKey /data/ssh/ssh_host_ed25519_key

LogLevel INFO

PermitRootLogin no
StrictModes yes
MaxAuthTries 3
MaxSessions 5

PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys

HostbasedAuthentication no
IgnoreUserKnownHosts yes
IgnoreRhosts yes

PasswordAuthentication no
ChallengeResponseAuthentication no

AllowAgentForwarding no
AllowTcpForwarding no
GatewayPorts no
X11Forwarding no
PrintMotd no
PermitUserEnvironment no
UseDNS no

AllowUsers git

Banner none

Subsystem sftp /usr/lib/ssh/sftp-server

+ 9
- 0
files/usr/local/bin/entrypoint Datei anzeigen

@@ -0,0 +1,9 @@
#!/bin/sh

set -eu

if [ $# -eq 0 ]; then
exec /bin/s6-svscan /etc/s6
else
exec /sbin/su-exec "$@"
fi

+ 5
- 0
hooks/build Datei anzeigen

@@ -0,0 +1,5 @@
#!/bin/sh

set -eu

exec ./build.sh

Laden…
Abbrechen
Speichern