瀏覽代碼

[annex] Docker build with debian and git annex

cgars 8 年之前
父節點
當前提交
884c57e578
共有 3 個文件被更改,包括 18 次插入16 次删除
  1. 17 8
      Dockerfile
  2. 0 2
      docker/build-go.sh
  3. 1 6
      docker/build.sh

+ 17 - 8
Dockerfile

@@ -1,18 +1,27 @@
-FROM alpine:3.5
+FROM ubuntu:16.04
+
+ENV DEBIAN_FRONTEND noninteractive
+
+RUN apt-get update &&                                   \
+    apt-get install -y --no-install-recommends          \
+                       gcc g++ libc6-dev make golang    \
+                       git git-annex openssh-server     \
+                       python-pip python-setuptools     \
+                       socat tzdata supervisor patch    \
+                       libpam0g-dev \
+    && rm -rf /var/lib/apt/lists/*
+
+RUN pip install pyyaml
 
-# Install system utils & Gogs runtime dependencies
-ADD https://github.com/tianon/gosu/releases/download/1.9/gosu-amd64 /usr/sbin/gosu
-RUN chmod +x /usr/sbin/gosu \
- && apk --no-cache --no-progress add ca-certificates bash git linux-pam s6 curl openssh socat tzdata
 
 ENV GOGS_CUSTOM /data/gogs
 
 COPY . /app/gogs/build
 WORKDIR /app/gogs/build
 
-RUN    ./docker/build-go.sh \
-    && ./docker/build.sh \
-    && ./docker/finalize.sh
+RUN ./docker/build-go.sh
+RUN ./docker/build.sh
+RUN ./docker/finalize.sh
 
 # Configure LibC Name Service
 COPY docker/nsswitch.conf /etc/nsswitch.conf

+ 0 - 2
docker/build-go.sh

@@ -11,7 +11,6 @@ export GOLANG_SRC_SHA256="406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5
 
 
 # Install build tools
-apk add --no-cache --no-progress --virtual build-deps-go gcc musl-dev openssl go
 
 export GOROOT_BOOTSTRAP="$(go env GOROOT)"
 
@@ -29,4 +28,3 @@ patch -p2 -i /app/gogs/build/docker/no-pic.patch
 
 # Clean
 rm /app/gogs/build/docker/*.patch
-apk del build-deps-go

+ 1 - 6
docker/build.sh

@@ -7,9 +7,6 @@ export GOPATH=/tmp/go
 export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin
 export GO15VENDOREXPERIMENT=1
 
-# Install build deps
-apk --no-cache --no-progress add --virtual build-deps build-base linux-pam-dev
-
 # Build Gogs
 mkdir -p ${GOPATH}/src/github.com/gogits/
 ln -s /app/gogs/build ${GOPATH}/src/github.com/gogits/gogs
@@ -21,9 +18,7 @@ make build TAGS="sqlite cert pam"
 # Cleanup GOPATH
 rm -r $GOPATH
 
-# Remove build deps
-apk --no-progress del build-deps
 
 # Create git user for Gogs
-adduser -H -D -g 'Gogs Git User' git -h /data/git -s /bin/bash && passwd -u git
+adduser git --home /data/git --shell /bin/bash
 echo "export GOGS_CUSTOM=${GOGS_CUSTOM}" >> /etc/profile