Skip to content

Commit

Permalink
Merge pull request #179 from Bitspark/skip-checks
Browse files Browse the repository at this point in the history
Skip checks
  • Loading branch information
jm9e authored Oct 23, 2018
2 parents df3ce14 + aa8fb2f commit c35ef62
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 19 deletions.
47 changes: 30 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,33 +1,46 @@
FROM golang:1.11
ARG slVersion
ARG slBuildTime
### Checkout UI, Lib and Examples and Build UI
FROM node:8.12
WORKDIR /slang/

LABEL maintainer="[email protected]"
# Clone examples, libs and ui
RUN git clone https://github.com/Bitspark/slang-examples.git examples && \
git clone https://github.com/Bitspark/slang-lib.git lib && \
git clone https://github.com/Bitspark/slang-ui.git ui

LABEL version="1"
# Checkout latest lib release
RUN cd lib && \
git checkout $(git describe --tags `git rev-list --tags --max-count=1`)

WORKDIR /go/src/slang
COPY . .
# Checkout and build latest UI release
RUN cd ui && \
git checkout $(git describe --tags `git rev-list --tags --max-count=1`) && \
npm install && \
./node_modules/@angular/cli/bin/ng build --base-href /app/ --prod --output-path=dist

RUN go get -d -v ./...

ENV ldFlagVersion "-X main.Version=${slVersion}"
ENV ldFlagBuildTime "-X main.BuildTime=${slBuildTime}"
ENV ldFlags "${ldFlagVersion} ${ldFlagBuildTime}"
### Build daemon
FROM golang:1.11
WORKDIR /go/src/slang

RUN echo $ldFlags
COPY . .
RUN go get -d -v ./... && \
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o slangd ./cmd/slangd

RUN env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "${ldFlags}" -o slangd ./cmd/slangd

### Gather UI, lib and daemon and run daemon
FROM alpine
LABEL maintainer="[email protected]"
LABEL version="1"
WORKDIR /root/slang/

RUN apk --no-cache add ca-certificates
WORKDIR "/root/slang/"
ENV USER root
ENV SLANG_PATH "/root/slang/"
COPY --from=0 /go/src/slang/slangd .
COPY --from=0 /slang/examples/examples projects/examples
COPY --from=0 /slang/lib/slang lib/slang/
COPY --from=0 /slang/ui/dist ui/
COPY --from=1 /go/src/slang/slangd .

EXPOSE 5149
EXPOSE 50001-50099

ENTRYPOINT ["/root/slang/slangd", "--only-daemon"]
ENTRYPOINT ["/root/slang/slangd", "--only-daemon", "--skip-checks"]
8 changes: 6 additions & 2 deletions cmd/slangd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ type EnvironPaths struct {
}

var onlyDaemon bool
var skipChecks bool

func main() {
flag.BoolVar(&onlyDaemon, "only-daemon", false, "Prevent from automatically opening slang ui")
flag.BoolVar(&onlyDaemon, "only-daemon", false, "Don't automatically open UI")
flag.BoolVar(&skipChecks, "skip-checks", false, "Skip checking and updating UI and Lib")
flag.Parse()

buildTime, _ := strconv.ParseInt(BuildTime, 10, 64)
Expand All @@ -53,7 +55,9 @@ func main() {

srv := daemon.New("localhost", PORT)

envPaths.loadLocalComponents()
if !skipChecks {
envPaths.loadLocalComponents()
}
envPaths.loadDaemonServices(srv)
envPaths.startDaemonServer(srv)
}
Expand Down

0 comments on commit c35ef62

Please sign in to comment.