dehub/Dockerfile.dehub-remote

44 lines
1.4 KiB
Docker
Raw Permalink Normal View History

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 .
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
# Copy binaries
COPY --from=0 /usr/bin/dehub /usr/bin/dehub
COPY --from=0 /usr/bin/git-http-server /usr/bin/git-http-server
# Create config files for container startup and nginx
COPY cmd/dehub-remote/nginx.conf /etc/nginx/nginx.conf
# Create start.sh
COPY cmd/dehub-remote/start.sh /start.sh
RUN chmod +x /start.sh
ENTRYPOINT ["/start.sh"]