Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch local-dev/git image to alpine #1542

Merged
merged 1 commit into from Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 18 additions & 5 deletions local-dev/git/Dockerfile
@@ -1,12 +1,23 @@
FROM unixtastic/git-ssh-server
FROM alpine:3.11

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