diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5cb562b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +web/node_modules/ +web/build/ +.travis/ +docker/ +scripts/ +*.sh +*.yml +*.md +docs/ +LICENSE \ No newline at end of file diff --git a/.gitignore b/.gitignore index b081f72..591c945 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,5 @@ importer-csv .config.yml main + +build/ diff --git a/.travis/run.sh b/.travis/run.sh index 901a0a4..c0d3572 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..319b18c --- /dev/null +++ b/Dockerfile @@ -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 ./ \ No newline at end of file diff --git a/docker/Dockerfile.frontend b/docker/Dockerfile.frontend index 619e9f3..8e4468d 100644 --- a/docker/Dockerfile.frontend +++ b/docker/Dockerfile.frontend @@ -1,4 +1,4 @@ -FROM node:12-alpine +FROM node:14-alpine ARG USER_ID ARG GROUP_ID @@ -6,4 +6,4 @@ ARG GROUP_ID RUN deluser node && \ addgroup --gid ${GROUP_ID} dev && \ adduser --uid ${USER_ID} -G dev -D dev -USER dev \ No newline at end of file +USER dev