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
No related branches found
No related tags found
3 merge requests!90Develop,!63Resolve "Dockerfile",!53V.0.1.0 Codename Threadbare
Pipeline #52982 passed
......@@ -3,7 +3,8 @@ variables:
stages:
- test
- documentation
- build
- deploy
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"
......@@ -12,3 +13,4 @@ include:
- local: '/build/ci/.code-quality-ci.yml'
- local: '/build/ci/.documentation-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:
name: pandoc/latex
entrypoint:
- ''
stage: documentation
stage: deploy
rules:
- changes:
- documentation/design/*.md
......@@ -22,7 +22,7 @@ documentation:pdf:
- cargo install mdbook
image:
name: rust:latest
stage: documentation
stage: deploy
script:
- mdbook build documentation --dest-dir public
cache:
......
......@@ -4,13 +4,12 @@ import (
"code.fbi.h-da.de/cocsn/gosdn/log"
"code.fbi.h-da.de/cocsn/gosdn/nucleus"
"flag"
"log/syslog"
)
func main() {
// 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")
configFileName := flag.String("config-file", "", "Path to the config file")
......@@ -18,16 +17,6 @@ func main() {
cliSocket := *cliListenAddr + ":" + *cliListenPort
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.
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