aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
diff options
context:
space:
mode:
authorEmiliano Ciavatta2020-09-16 15:57:23 +0000
committerEmiliano Ciavatta2020-09-16 15:57:23 +0000
commit7907dd6fa6702f79d1be9ef8e483fa5533869eb7 (patch)
tree4fda7da525d7a224797c8a0997b426d25201bdd8 /Dockerfile
parent53301d30b56e5c328baf73d3bc512dc3170e49ea (diff)
parenta77f2f97f1df204c663119fe8ccafb6f274cb634 (diff)
Merge branch 'develop' into feature/frontend
Diffstat (limited to 'Dockerfile')
-rw-r--r--Dockerfile28
1 files changed, 24 insertions, 4 deletions
diff --git a/Dockerfile b/Dockerfile
index 0092628..e3c49bc 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,12 @@
-FROM ubuntu:20.04
+# BUILD STAGE
+FROM ubuntu:20.04 AS BUILDSTAGE
# 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
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -qq git golang-1.14 pkg-config libpcap-dev libhyperscan-dev yarnpkg curl
RUN ln -sf ../lib/go-1.14/bin/go /usr/bin/go
-ENV GIN_MODE release
COPY . /caronte
@@ -13,6 +14,25 @@ WORKDIR /caronte
RUN go mod download && go build
-RUN cd frontend && yarnpkg install && yarnpkg build
+RUN cd frontend && \
+ yarnpkg install && \
+ yarnpkg build --production=true
+RUN curl -sf https://gobinaries.com/tj/node-prune | sh && cd /caronte/frontend && node-prune
+
+
+# LAST STAGE
+FROM ubuntu:20.04
+
+COPY --from=BUILDSTAGE /caronte/caronte /caronte/caronte
+COPY --from=BUILDSTAGE /caronte/frontend /caronte/frontend
+COPY --from=BUILDSTAGE /caronte/shared /caronte/shared
+
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -qq libpcap-dev libhyperscan-dev && \
+ rm -rf /var/lib/apt/lists/*
+
+ENV GIN_MODE release
+
+WORKDIR /caronte
CMD ./caronte