Skip to content

Commit

Permalink
Build go-graphkb in docker.
Browse files Browse the repository at this point in the history
This avoid adherence with the CI service.
  • Loading branch information
clems4ever committed Dec 10, 2020
1 parent 87aab03 commit 7ac08ef
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 7 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
web/node_modules/
web/build/
.travis/
docker/
scripts/
*.sh
*.yml
*.md
docs/
LICENSE
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ importer-csv

.config.yml
main

build/
11 changes: 6 additions & 5 deletions .travis/run.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/bin/bash

go test -v ./...

pushd web && npm ci && npm run build && popd
go build -o go-graphkb cmd/go-graphkb/main.go
go build -o importer-csv cmd/importer-csv/main.go
docker build -t go-graphkb-build .

cid=`docker create go-graphkb-build`
docker cp $cid:/node/src/go-graphkb .
docker cp $cid:/node/src/importer-csv .
docker cp $cid:/node/src/build web/
docker rm $cid
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM golang:1.14-alpine AS go-builder

WORKDIR /go/src/
COPY go.mod go.sum ./

RUN go mod download

COPY cmd cmd
COPY graphkb graphkb
COPY internal internal
RUN cd cmd/go-graphkb && GOOS=linux GOARCH=amd64 go build -o go-graphkb main.go
RUN cd cmd/go-graphkb && GOOS=linux GOARCH=amd64 go build -o importer-csv main.go



FROM node:14-alpine AS node-builder

WORKDIR /node/src/

COPY web .

RUN yarn install && yarn build

COPY --from=go-builder /go/src/cmd/go-graphkb/go-graphkb ./
COPY --from=go-builder /go/src/cmd/go-graphkb/importer-csv ./
4 changes: 2 additions & 2 deletions docker/Dockerfile.frontend
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM node:12-alpine
FROM node:14-alpine

ARG USER_ID
ARG GROUP_ID

RUN deluser node && \
addgroup --gid ${GROUP_ID} dev && \
adduser --uid ${USER_ID} -G dev -D dev
USER dev
USER dev

0 comments on commit 7ac08ef

Please sign in to comment.