Skip to content

Commit

Permalink
Switch local-dev/git image to alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
smlx committed Jan 22, 2020
1 parent fff149e commit f108e01
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
23 changes: 18 additions & 5 deletions local-dev/git/Dockerfile
@@ -1,12 +1,23 @@
FROM unixtastic/git-ssh-server
FROM alpine:3.10

RUN apt-get update && apt-get install -y nginx fcgiwrap
RUN apk add --no-cache \
bash \
fcgiwrap \
git-daemon \
nginx \
openssh-server-pam \
runit \
spawn-fcgi

COPY service/fcgiwrap.sh /etc/service/fcgiwrap/run
COPY service/nginx.sh /etc/service/nginx/run
COPY nginx/git /etc/nginx/sites-enabled/git
RUN rm /etc/nginx/sites-enabled/default
COPY service/sshd.sh /etc/service/sshd/run
COPY nginx/git /etc/nginx/conf.d/git.conf

RUN rm /etc/nginx/conf.d/default.conf && mkdir /run/nginx \
&& adduser --disabled-password --home /git git \
&& ssh-keygen -A \
&& sed -E -i.bak -e 's/[# ]+UsePAM.*/UsePAM yes/g' /etc/ssh/sshd_config

USER git

Expand All @@ -31,4 +42,6 @@ RUN mkdir -m 700 /git/.ssh && \

USER root

COPY authorized-keys.sh /etc/my_init.d/authorized-keys.sh
COPY entrypoint.sh /usr/sbin/entrypoint.sh

ENTRYPOINT ["/usr/sbin/entrypoint.sh"]
@@ -1,8 +1,7 @@
#!/bin/bash
set -e

if [ ! -z "$GIT_AUTHORIZED_KEYS" ]; then
if [ "$GIT_AUTHORIZED_KEYS" ]; then
echo -e "$GIT_AUTHORIZED_KEYS" > /git/.ssh/authorized_keys
fi

exec "$@"
exec /sbin/runsvdir /etc/service
4 changes: 2 additions & 2 deletions local-dev/git/nginx/git
Expand Up @@ -3,12 +3,12 @@ server {
server_name _;

location ~ /git(/.*) {
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
# export all repositories under GIT_PROJECT_ROOT
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /git;
fastcgi_param PATH_INFO $1;
include fastcgi_params;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
}
}
2 changes: 1 addition & 1 deletion local-dev/git/service/fcgiwrap.sh
@@ -1,2 +1,2 @@
#!/bin/sh
exec /usr/bin/spawn-fcgi -n -P /var/run/fcgiwrap.pid -F '1' -s '/var/run/fcgiwrap.socket' -u 'www-data' -U 'www-data' -g 'www-data' -G 'www-data' -- /usr/sbin/fcgiwrap -f
exec /usr/bin/spawn-fcgi -n -P /run/fcgiwrap.pid -F '1' -s '/run/fcgiwrap.socket' -u 'nginx' -U 'nginx' -g 'nginx' -G 'nginx' -- /usr/bin/fcgiwrap -f
2 changes: 1 addition & 1 deletion local-dev/git/service/nginx.sh
@@ -1,2 +1,2 @@
#!/bin/sh
exec /usr/sbin/nginx -c /etc/nginx/nginx.conf -g "daemon off;"
exec /usr/sbin/nginx -c /etc/nginx/nginx.conf -g "daemon off;"
3 changes: 3 additions & 0 deletions local-dev/git/service/sshd.sh
@@ -0,0 +1,3 @@
#!/bin/sh

exec /usr/sbin/sshd -D

0 comments on commit f108e01

Please sign in to comment.