Skip to content

Commit 755c84c

Browse files
author
willemvd
committed
use new gitea docker image as base image and customize a few files
1 parent 8603a6c commit 755c84c

File tree

9 files changed

+59
-74
lines changed

9 files changed

+59
-74
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.git
22
.github/
33
.dockerignore
4-
.DS_Store/s
4+
**/**/.DS_Store

Dockerfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
FROM willemvd/ubuntu-unprivileged-git-ssh:1.0.0
1+
FROM gitea/gitea:latest
22
MAINTAINER willemvd <willemvd@github>
33

4-
USER root
4+
ENV HOME /data/git
55

6-
COPY ./docker /app/gitea/docker
6+
COPY docker /
77

8-
RUN /app/gitea/docker/init/10-setup-gitea.sh && rm -rf docker
8+
RUN rm -rf /etc/s6/syslogd && \
9+
chmod g+w /etc/passwd /var/run && \
10+
chmod -R g+w /etc/s6 && \
11+
chown -R git:root /app
912

1013
USER git
1114

12-
# persistent volume for the host ssh key and gitea data
13-
VOLUME ["/etc/ssh/keys", "/data"]
14-
1515
EXPOSE 2222 3000
16-
17-
# Use baseimage-docker's init system.
18-
ENTRYPOINT ["/sbin/my_init", "--"]

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22

33
To support Gitea on an environment where no root user is allowed to run, like OpenShift Dedicated/Online, this Docker image can be used.
44

5-
The base image for this Gitea container is the Ubuntu unprivileged SSH Git container.
5+
The base image for this Gitea container is the Gitea official image
6+
7+
To be able to do so, we run
8+
- the OpenSSH server on port 2222 instead of 22
9+
- don't use syslogd, but let sshd print to stdout/stderr instead of file

docker/etc/ssh/sshd_config

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
Port 2222
2+
Protocol 2
3+
4+
PidFile /var/run/sshd.pid
5+
6+
AddressFamily any
7+
ListenAddress 0.0.0.0
8+
ListenAddress ::
9+
10+
LogLevel INFO
11+
12+
HostKey /data/ssh/ssh_host_ed25519_key
13+
HostKey /data/ssh/ssh_host_rsa_key
14+
HostKey /data/ssh/ssh_host_dsa_key
15+
HostKey /data/ssh/ssh_host_ecdsa_key
16+
17+
AuthorizedKeysFile .ssh/authorized_keys
18+
19+
UseDNS no
20+
AllowAgentForwarding no
21+
AllowTcpForwarding no
22+
PrintMotd no
23+
24+
PermitUserEnvironment yes
25+
PermitRootLogin no
26+
ChallengeResponseAuthentication no
27+
PasswordAuthentication no
28+
PermitEmptyPasswords no
29+
30+
AllowUsers git
31+
32+
Banner none
33+
Subsystem sftp /usr/lib/ssh/sftp-server
34+
UsePrivilegeSeparation no

docker/gitea.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

docker/init/00-init-git-user-and-folders.sh

Lines changed: 0 additions & 23 deletions
This file was deleted.

docker/init/10-setup-gitea.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

docker/usr/bin/entrypoint

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
sed -e "s/git:x:1000:/git:x:`id -u`:/g" /etc/passwd > /tmp/passwd && cat /tmp/passwd > /etc/passwd
3+
4+
for FOLDER in /data/gitea/conf /data/gitea/log /data/git /data/ssh; do
5+
mkdir -p ${FOLDER}
6+
done
7+
8+
if [ $# -gt 0 ]; then
9+
exec "$@"
10+
else
11+
exec /bin/s6-svscan /etc/s6
12+
fi

openshift-gitea-template.yaml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ objects:
6767
resources: {}
6868
terminationMessagePath: /dev/termination-log
6969
volumeMounts:
70-
- mountPath: /etc/ssh/keys
71-
name: gitea-ssh-keys
7270
- mountPath: /data
7371
name: gitea-data
7472
livenessProbe:
@@ -96,9 +94,6 @@ objects:
9694
securityContext: {}
9795
terminationGracePeriodSeconds: 30
9896
volumes:
99-
- name: gitea-ssh-keys
100-
persistentVolumeClaim:
101-
claimName: gitea-ssh-keys
10297
- name: gitea-data
10398
persistentVolumeClaim:
10499
claimName: gitea-data
@@ -163,16 +158,6 @@ objects:
163158
resources:
164159
requests:
165160
storage: ${GITEA_DATA_VOLUME_CAPACITY}
166-
- kind: PersistentVolumeClaim
167-
apiVersion: v1
168-
metadata:
169-
name: gitea-ssh-keys
170-
spec:
171-
accessModes:
172-
- ReadWriteMany
173-
resources:
174-
requests:
175-
storage: ${GITEA_SSH_KEYS_VOLUME_CAPACITY}
176161
parameters:
177162
- description: The name for the application.
178163
name: APPLICATION_NAME
@@ -189,10 +174,6 @@ parameters:
189174
- description: 'Custom hostname for http service route. Leave blank for default hostname, e.g.: <application-name>-<project>.<default-domain-suffix>'
190175
name: HOSTNAME
191176
value: ""
192-
- description: Volume space available for data, e.g. 512Mi, 2Gi
193-
name: GITEA_SSH_KEYS_VOLUME_CAPACITY
194-
required: true
195-
value: 1Mi
196177
- description: Volume space available for Gitea repository data, e.g. 512Mi, 2Gi
197178
name: GITEA_DATA_VOLUME_CAPACITY
198179
required: true

0 commit comments

Comments
 (0)