Browse Source

Build Docker image.

master
Syfaro 4 months ago
parent
commit
7b0643b101
3 changed files with 35 additions and 5 deletions
  1. 28
    0
      .drone.yml
  2. 6
    0
      Dockerfile
  3. 1
    5
      mcapi.go

+ 28
- 0
.drone.yml View File

@@ -26,6 +26,20 @@ steps:
26 26
     source: ./mcapi
27 27
     target: "/mcapi/${DRONE_COMMIT_SHA}"
28 28
 
29
+- name: build-image
30
+  image: plugins/docker
31
+  settings:
32
+    auto_tag: true
33
+    password:
34
+      from_secret: docker_password
35
+    registry: registry.huefox.com
36
+    repo: registry.huefox.com/mcapi
37
+    username:
38
+      from_secret: username
39
+  when:
40
+    branch:
41
+      - master
42
+
29 43
 ---
30 44
 kind: secret
31 45
 name: minio_access_key
@@ -54,4 +68,18 @@ get:
54 68
   path: drone/minio
55 69
   name: endpoint
56 70
 
71
+---
72
+kind: secret
73
+name: docker_username
74
+get:
75
+  path: drone/docker
76
+  name: username
77
+
78
+---
79
+kind: secret
80
+name: docker_password
81
+get:
82
+  path: drone/docker
83
+  name: password
84
+
57 85
 ...

+ 6
- 0
Dockerfile View File

@@ -0,0 +1,6 @@
1
+FROM golang:alpine
2
+WORKDIR /app
3
+RUN apk add git
4
+COPY . /app
5
+RUN go build -o /mcapi
6
+ENTRYPOINT [ "/mcapi", "-config", "/config.json" ]

+ 1
- 5
mcapi.go View File

@@ -4,7 +4,6 @@ import (
4 4
 	"encoding/json"
5 5
 	"errors"
6 6
 	"flag"
7
-	"io"
8 7
 	"io/ioutil"
9 8
 	"log"
10 9
 	"net/http"
@@ -146,10 +145,7 @@ func main() {
146 145
 
147 146
 	flag.Parse()
148 147
 
149
-	f, _ := os.OpenFile("mcapi.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
150
-	defer f.Close()
151
-
152
-	log.SetOutput(io.MultiWriter(f, os.Stdout))
148
+	log.SetOutput(os.Stdout)
153 149
 
154 150
 	if *genConfig {
155 151
 		generateConfig(*configFile)

Loading…
Cancel
Save