Yoginth 7 роки тому
батько
коміт
1bd7eb1972
3 змінених файлів з 25 додано та 9 видалено
  1. 21 4
      .gitlab-ci.yml
  2. 2 3
      Dockerfile
  3. 2 2
      docker/build.sh

+ 21 - 4
.gitlab-ci.yml

@@ -2,7 +2,7 @@ image: golang:alpine
 
 before_script:
     - apk update
-    - apk --no-cache --no-progress add --virtual build-deps build-base git linux-pam-dev
+    - apk --no-cache --no-progress add --virtual build-deps build-base git
 
 stages:
     - build
@@ -12,6 +12,7 @@ stages:
     - commands
     - image-test
     - pre-test-source
+    - deploy
 
 Build:
     image: golang:alpine
@@ -37,7 +38,7 @@ Build Dev Race:
     image: golang:latest
     before_script:
         - apt-get update -qq
-        - apt-get install -y libpam-dev zip unzip
+        - apt-get install -y zip unzip
     stage: build
     script:
         - mkdir -p $GOPATH/src/gitote
@@ -50,7 +51,7 @@ Build Prod:
     image: golang:latest
     before_script:
         - apt-get update -qq
-        - apt-get install -y libpam-dev zip unzip
+        - apt-get install -y zip unzip
     stage: build
     script:
         - mkdir -p $GOPATH/src/gitote
@@ -86,7 +87,7 @@ Test:
     image: golang:latest
     before_script:
         - apt-get update -qq
-        - apt-get install -y libpam-dev zip unzip
+        - apt-get install -y zip unzip
     stage: test
     script:
         - mkdir -p $GOPATH/src/gitote
@@ -181,3 +182,19 @@ Running:
         - cd gitote
         - go build
         - ./gitote web & sleep 20 ; kill $! || echo $?
+
+DockerHub:
+    image: docker:latest
+    stage: deploy
+    services:
+      - docker:dind
+    script:
+      - mkdir -p $GOPATH/src/gitote
+      - cd $GOPATH/src/gitote
+      - git clone https://gitote.in/gitote/gitote.git gitote
+      - cd gitote
+      - docker login -u yoginth -p $CI_REGISTRY_PASSWORD docker.io
+      - docker build -t gitote/gitote .
+      - docker push gitote/gitote:latest
+    only:
+      - master

+ 2 - 3
Dockerfile

@@ -3,10 +3,10 @@ FROM golang:alpine AS builder
 MAINTAINER "Yoginth <yoginth@icloud.com>"
 
 # Install build deps
-RUN apk --no-cache --no-progress add --virtual build-deps build-base git linux-pam-dev
+RUN apk --no-cache --no-progress add --virtual build-deps build-base git
 WORKDIR /go/src/gitote/gitote
 COPY . .
-RUN make build TAGS="sqlite cert pam"
+RUN make build
 
 FROM alpine:latest
 
@@ -19,7 +19,6 @@ RUN chmod +x /usr/sbin/gosu \
     ca-certificates \
     curl \
     git \
-    linux-pam \
     openssh \
     s6 \
     shadow \

+ 2 - 2
docker/build.sh

@@ -7,7 +7,7 @@ export GOPATH=/tmp/go
 export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin
 
 # Install build deps
-apk --no-cache --no-progress add --virtual build-deps build-base linux-pam-dev
+apk --no-cache --no-progress add --virtual build-deps build-base
 
 # Build Gitote
 mkdir -p ${GOPATH}/src/gitote/gitote/
@@ -16,7 +16,7 @@ cd ${GOPATH}/src/gitote/gitote
 
 # Needed since git 2.9.3 or 2.9.4
 git config --global http.https://gopkg.in.followRedirects true
-make build TAGS="sqlite cert pam"
+make build
 
 # Cleanup GOPATH
 rm -r $GOPATH