Skip to content
Snippets Groups Projects
Commit 6677ebc9 authored by Manuel Kieweg's avatar Manuel Kieweg
Browse files

Merge branch '47-dockerfile' into 'v.0.1.0-codename-threadbare'

Resolve "Dockerfile"

See merge request cocsn/gosdn!63
parents 9fab0da1 ad85c15a
Branches
Tags
3 merge requests!90Develop,!63Resolve "Dockerfile",!53V.0.1.0 Codename Threadbare
Pipeline #52982 passed
...@@ -3,7 +3,8 @@ variables: ...@@ -3,7 +3,8 @@ variables:
stages: stages:
- test - test
- documentation - build
- deploy
before_script: before_script:
- git config --global url."https://$GO_MODULES_USER:$GO_MODULES_ACCESS_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de" - git config --global url."https://$GO_MODULES_USER:$GO_MODULES_ACCESS_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de"
...@@ -12,3 +13,4 @@ include: ...@@ -12,3 +13,4 @@ include:
- local: '/build/ci/.code-quality-ci.yml' - local: '/build/ci/.code-quality-ci.yml'
- local: '/build/ci/.documentation-ci.yml' - local: '/build/ci/.documentation-ci.yml'
- local: '/build/ci/.security-and-compliance-ci.yml' - local: '/build/ci/.security-and-compliance-ci.yml'
- local: '/build/ci/.build-container.yml'
\ No newline at end of file
FROM golang:1.15-alpine AS builder
ARG GITLAB_USER
ARG GITLAB_TOKEN
WORKDIR /src/gosdn
COPY . .
RUN apk add git
RUN git config --global url."https://$GITLAB_USER:$GITLAB_TOKEN@code.fbi.h-da.de".insteadOf "https://code.fbi.h-da.de"
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build ./cmd/gosdn
FROM alpine:latest
EXPOSE 8443
EXPOSE 55055
COPY --from=builder /src/gosdn/gosdn .
COPY --from=builder /src/gosdn/configs ./configs
ENTRYPOINT [ "./gosdn" ]
CMD [""]
variables:
DOCKER_IMAGE_SHA: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
build:docker:
stage: build
tags:
- baremetal
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- >
docker build \
--build-arg GITLAB_USER=$GO_MODULES_USER \
--build-arg GITLAB_TOKEN=$GO_MODULES_ACCESS_TOKEN \
-t $DOCKER_IMAGE_SHA .
.deploy: &deploy
stage: deploy
needs: ["build:docker"]
tags:
- baremetal
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker tag $DOCKER_IMAGE_SHA $TAG
- docker push $TAG
deploy:develop:
variables:
TAG: $CI_REGISTRY_IMAGE:develop
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
<<: *deploy
deploy:tagged:
variables:
TAG: $CI_REGISTRY_IMAGE:CI_COMMIT_TAG
rules:
- if: $CI_COMMIT_TAG
<<: *deploy
deploy:latest:
variables:
TAG: $CI_REGISTRY_IMAGE:latest
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
<<: *deploy
\ No newline at end of file
...@@ -5,7 +5,7 @@ documentation:pdf: ...@@ -5,7 +5,7 @@ documentation:pdf:
name: pandoc/latex name: pandoc/latex
entrypoint: entrypoint:
- '' - ''
stage: documentation stage: deploy
rules: rules:
- changes: - changes:
- documentation/design/*.md - documentation/design/*.md
...@@ -22,7 +22,7 @@ documentation:pdf: ...@@ -22,7 +22,7 @@ documentation:pdf:
- cargo install mdbook - cargo install mdbook
image: image:
name: rust:latest name: rust:latest
stage: documentation stage: deploy
script: script:
- mdbook build documentation --dest-dir public - mdbook build documentation --dest-dir public
cache: cache:
......
...@@ -4,13 +4,12 @@ import ( ...@@ -4,13 +4,12 @@ import (
"code.fbi.h-da.de/cocsn/gosdn/log" "code.fbi.h-da.de/cocsn/gosdn/log"
"code.fbi.h-da.de/cocsn/gosdn/nucleus" "code.fbi.h-da.de/cocsn/gosdn/nucleus"
"flag" "flag"
"log/syslog"
) )
func main() { func main() {
// register our supported flags // register our supported flags
cliListenAddr := flag.String("cli-listen-addr", "localhost", "The IP address of the grpcCLI.") cliListenAddr := flag.String("cli-listen-addr", "", "The IP address of the grpcCLI.")
cliListenPort := flag.String("cli-server-port", "55055", "The port number of the grpcCLI") cliListenPort := flag.String("cli-server-port", "55055", "The port number of the grpcCLI")
configFileName := flag.String("config-file", "", "Path to the config file") configFileName := flag.String("config-file", "", "Path to the config file")
...@@ -18,16 +17,6 @@ func main() { ...@@ -18,16 +17,6 @@ func main() {
cliSocket := *cliListenAddr + ":" + *cliListenPort cliSocket := *cliListenAddr + ":" + *cliListenPort
log.Loglevel(log.DEBUG) log.Loglevel(log.DEBUG)
syslogWriter, err := syslog.New(syslog.LOG_ALERT, "gosdn")
defer func() {
if err := syslogWriter.Close(); err != nil {
log.Fatal(err)
}
}()
if err != nil {
log.Fatal(err)
}
log.LoglevelOutput(log.INFO, syslogWriter)
// Setup a channel to communicate if goSDN should shutdown. // Setup a channel to communicate if goSDN should shutdown.
IsRunningChannel := make(chan bool) IsRunningChannel := make(chan bool)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment