Browse Source

Build Docker image.

master
Syfaro 9 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:
source: ./mcapi
target: "/mcapi/${DRONE_COMMIT_SHA}"

- name: build-image
image: plugins/docker
settings:
auto_tag: true
password:
from_secret: docker_password
registry: registry.huefox.com
repo: registry.huefox.com/mcapi
username:
from_secret: username
when:
branch:
- master

---
kind: secret
name: minio_access_key
@@ -54,4 +68,18 @@ get:
path: drone/minio
name: endpoint

---
kind: secret
name: docker_username
get:
path: drone/docker
name: username

---
kind: secret
name: docker_password
get:
path: drone/docker
name: password

...

+ 6
- 0
Dockerfile View File

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

+ 1
- 5
mcapi.go View File

@@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"flag"
"io"
"io/ioutil"
"log"
"net/http"
@@ -146,10 +145,7 @@ func main() {

flag.Parse()

f, _ := os.OpenFile("mcapi.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
defer f.Close()

log.SetOutput(io.MultiWriter(f, os.Stdout))
log.SetOutput(os.Stdout)

if *genConfig {
generateConfig(*configFile)


Loading…
Cancel
Save