aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorEmiliano Ciavatta2021-07-28 18:12:14 +0000
committerEmiliano Ciavatta2021-07-28 18:12:14 +0000
commit99cfe84c23f3beb8baf76b799ace1b3ffbf1d5ff (patch)
tree41d8bbbe2f46051aeebf5b4ae73c46325c4bf7c6 /Dockerfile
parentfdb0bf97d2dec72adf08e5f2d7ad65b560d8cf8e (diff)
parentf60d7cb1da70d439cd401e2fa4b7ecccec41bfe4 (diff)
Merge branch 'release/1.21.0' into main
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile52
1 files changed, 34 insertions, 18 deletions
diff --git a/Dockerfile b/Dockerfile
index a9c8134..0573a6c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,38 +1,54 @@
-# BUILD STAGE
-FROM ubuntu:20.04 AS BUILDSTAGE
+# Build backend with go
+FROM golang:1.16 AS BACKEND_BUILDER
# Install tools and libraries
RUN apt-get update && \
- DEBIAN_FRONTEND=noninteractive apt-get install -qq git golang-1.14 pkg-config libpcap-dev libhyperscan-dev yarnpkg
-
-COPY . /caronte
+ DEBIAN_FRONTEND=noninteractive apt-get install -qq \
+ git \
+ pkg-config \
+ libpcap-dev \
+ libhyperscan-dev
WORKDIR /caronte
-RUN ln -sf ../lib/go-1.14/bin/go /usr/bin/go && \
- export VERSION=$(git describe --tags) && \
+COPY . ./
+
+RUN export VERSION=$(git describe --tags --abbrev=0) && \
go mod download && \
go build -ldflags "-X main.Version=$VERSION" && \
- cd frontend && \
- yarnpkg install && \
- yarnpkg build --production=true && \
- cd - && \
- mkdir -p /caronte-build/frontend && \
- cp -r caronte pcaps/ scripts/ shared/ test_data/ /caronte-build && \
- cp -r frontend/build/ /caronte-build/frontend
+ mkdir -p build && \
+ cp -r caronte pcaps/ scripts/ shared/ test_data/ build/
+
+
+# Build frontend via yarn
+FROM node:16 as FRONTEND_BUILDER
+
+WORKDIR /caronte-frontend
+
+COPY ./frontend ./
+
+RUN yarn install && yarn build --production=true
# LAST STAGE
FROM ubuntu:20.04
-COPY --from=BUILDSTAGE /caronte-build /caronte
+COPY --from=BACKEND_BUILDER /caronte/build /opt/caronte
+
+COPY --from=FRONTEND_BUILDER /caronte-frontend/build /opt/caronte/frontend/build
RUN apt-get update && \
- DEBIAN_FRONTEND=noninteractive apt-get install -qq libpcap-dev libhyperscan-dev && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -qq \
+ libpcap-dev \
+ libhyperscan-dev && \
rm -rf /var/lib/apt/lists/*
ENV GIN_MODE release
-WORKDIR /caronte
+ENV MONGO_HOST mongo
+
+ENV MONGO_PORT 27017
+
+WORKDIR /opt/caronte
-CMD ./caronte
+ENTRYPOINT ./caronte -mongo-host ${MONGO_HOST} -mongo-port ${MONGO_PORT} -assembly_memuse_log