2020-03-27 03:14:54 +00:00
|
|
|
FROM golang:1.14
|
|
|
|
WORKDIR /go/src/dehub
|
|
|
|
COPY . .
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /usr/bin/dehub ./cmd/dehub
|
|
|
|
|
|
|
|
WORKDIR /go/src/dehub/cmd/git-http-server
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /usr/bin/git-http-server .
|
|
|
|
|
2020-02-16 03:32:00 +00:00
|
|
|
FROM debian:jessie
|
|
|
|
|
|
|
|
# Setup Container
|
|
|
|
VOLUME ["/repos"]
|
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
# Setup APT
|
|
|
|
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
|
|
|
|
|
|
|
|
# Update, Install Prerequisites, Clean Up APT
|
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update && \
|
|
|
|
apt-get -y install git wget nginx-full fcgiwrap && \
|
|
|
|
apt-get clean
|
|
|
|
|
|
|
|
# Setup Container User
|
|
|
|
RUN useradd -M -s /bin/false git --uid 1000
|
|
|
|
|
|
|
|
# Setup nginx fcgi services to run as user git, group git
|
|
|
|
RUN sed -i 's/FCGI_USER="www-data"/FCGI_USER="git"/g' /etc/init.d/fcgiwrap && \
|
|
|
|
sed -i 's/FCGI_GROUP="www-data"/FCGI_GROUP="git"/g' /etc/init.d/fcgiwrap && \
|
|
|
|
sed -i 's/FCGI_SOCKET_OWNER="www-data"/FCGI_SOCKET_OWNER="git"/g' /etc/init.d/fcgiwrap && \
|
|
|
|
sed -i 's/FCGI_SOCKET_GROUP="www-data"/FCGI_SOCKET_GROUP="git"/g' /etc/init.d/fcgiwrap
|
|
|
|
|
2020-03-27 03:14:54 +00:00
|
|
|
# Copy binaries
|
|
|
|
COPY --from=0 /usr/bin/dehub /usr/bin/dehub
|
|
|
|
COPY --from=0 /usr/bin/git-http-server /usr/bin/git-http-server
|
|
|
|
|
2020-02-16 03:32:00 +00:00
|
|
|
# Create config files for container startup and nginx
|
2020-03-27 03:24:22 +00:00
|
|
|
COPY cmd/dehub-remote/nginx.conf /etc/nginx/nginx.conf
|
2020-02-16 03:32:00 +00:00
|
|
|
|
|
|
|
# Create pre-receive
|
2020-03-27 03:24:22 +00:00
|
|
|
COPY cmd/dehub-remote/pre-receive /pre-receive
|
2020-02-16 03:32:00 +00:00
|
|
|
|
|
|
|
# Create start.sh
|
2020-03-27 03:24:22 +00:00
|
|
|
COPY cmd/dehub-remote/start.sh /start.sh
|
2020-02-16 03:32:00 +00:00
|
|
|
RUN chmod +x /start.sh
|
|
|
|
|
|
|
|
ENTRYPOINT ["/start.sh"]
|