Browse Source

add new Dockerfile.docker-ce for docker-ce(>=v17.06) to build docker image

pull/5321/head
Michael Li 7 years ago
parent
commit
6400906380
  1. 42
      Dockerfile.docker-ce
  2. 19
      docker/finalize-docker-ce.sh
  3. 1
      docker/finalize.sh

42
Dockerfile.docker-ce

@ -0,0 +1,42 @@
FROM golang:1.10.3-alpine AS binarybuilder
# Install build deps
RUN apk --no-cache --no-progress add --virtual build-deps build-base git linux-pam-dev
WORKDIR /go/src/github.com/gogs/gogs
COPY . .
RUN make build TAGS="sqlite cert pam"
FROM alpine:3.7
# Install system utils & Gogs runtime dependencies
ADD https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 /usr/sbin/gosu
RUN chmod +x /usr/sbin/gosu \
&& echo http://dl-2.alpinelinux.org/alpine/edge/community/ >> /etc/apk/repositories \
&& apk --no-cache --no-progress add \
bash \
ca-certificates \
curl \
git \
linux-pam \
openssh \
s6 \
shadow \
socat \
tzdata
ENV GOGS_CUSTOM /data/gogs
# Configure LibC Name Service
COPY docker/nsswitch.conf /etc/nsswitch.conf
WORKDIR /app/gogs
COPY docker ./docker
COPY templates ./templates
COPY public ./public
COPY --from=binarybuilder /go/src/github.com/gogs/gogs/gogs .
RUN ./docker/finalize-docker-ce.sh
# Configure Docker Container
VOLUME ["/data"]
EXPOSE 22 3000
ENTRYPOINT ["/app/gogs/docker/start.sh"]
CMD ["/bin/s6-svscan", "/app/gogs/docker/s6/"]

19
docker/finalize-docker-ce.sh

@ -0,0 +1,19 @@
#!/bin/sh
# Finalize the build
set -x
set -e
# Create git user for Gogs
addgroup -S git
adduser -G git -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && usermod -p '*' git && passwd -u git
echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile
# Final cleaning
rm /app/gogs/docker/build.sh
rm /app/gogs/docker/build-go.sh
rm /app/gogs/docker/finalize.sh
rm /app/gogs/docker/finalize-docker-ce.sh
rm /app/gogs/docker/nsswitch.conf
rm /app/gogs/docker/README.md

1
docker/finalize.sh

@ -12,6 +12,7 @@ rm -rf /app/gogs/build
rm /app/gogs/docker/build.sh
rm /app/gogs/docker/build-go.sh
rm /app/gogs/docker/finalize.sh
rm /app/gogs/docker/finalize-docker-ce.sh
rm /app/gogs/docker/nsswitch.conf
rm /app/gogs/docker/README.md

Loading…
Cancel
Save