aboutsummaryrefslogtreecommitdiff
path: root/Dockerfile
blob: e3c49bc888199f8f2903acdcfead03a698e5aa60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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 curl

RUN ln -sf ../lib/go-1.14/bin/go /usr/bin/go


COPY . /caronte

WORKDIR /caronte

RUN go mod download && go 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