aboutsummaryrefslogtreecommitdiff
path: root/.github/docker
diff options
context:
space:
mode:
Diffstat (limited to '.github/docker')
-rw-r--r--.github/docker/Dockerfile18
-rw-r--r--.github/docker/Dockerfile-backend18
-rw-r--r--.github/docker/Dockerfile-frontend7
-rw-r--r--.github/docker/docker-compose.yml12
4 files changed, 34 insertions, 21 deletions
diff --git a/.github/docker/Dockerfile b/.github/docker/Dockerfile
deleted file mode 100644
index 1f9f72d..0000000
--- a/.github/docker/Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM ubuntu:20.04
-
-# Install tools and libraries
-RUN apt-get update && \
- DEBIAN_FRONTEND=noninteractive apt-get install -qq golang-1.14 pkg-config libpcap-dev libhyperscan-dev yarnpkg
-
-COPY ./ /caronte
-
-WORKDIR /caronte
-
-RUN ln -sf ../lib/go-1.14/bin/go /usr/bin/go && \
- go mod download && \
- go build && \
- cd frontend && \
- yarnpkg install && \
- yarnpkg build
-
-CMD go test -v -race -covermode=atomic
diff --git a/.github/docker/Dockerfile-backend b/.github/docker/Dockerfile-backend
new file mode 100644
index 0000000..06036e4
--- /dev/null
+++ b/.github/docker/Dockerfile-backend
@@ -0,0 +1,18 @@
+FROM golang:1.16
+
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -qq \
+ git \
+ pkg-config \
+ libpcap-dev \
+ libhyperscan-dev
+
+WORKDIR /caronte
+
+COPY . ./
+
+RUN export VERSION=$(git describe --tags --abbrev=0) && \
+ go mod download && \
+ go build -ldflags "-X main.Version=$VERSION"
+
+ENTRYPOINT go test -v -race -covermode=atomic
diff --git a/.github/docker/Dockerfile-frontend b/.github/docker/Dockerfile-frontend
new file mode 100644
index 0000000..5cd82b0
--- /dev/null
+++ b/.github/docker/Dockerfile-frontend
@@ -0,0 +1,7 @@
+FROM node:16
+
+WORKDIR /caronte-frontend
+
+COPY ./frontend ./
+
+RUN yarn install && yarn build
diff --git a/.github/docker/docker-compose.yml b/.github/docker/docker-compose.yml
index 393bb41..ddaf839 100644
--- a/.github/docker/docker-compose.yml
+++ b/.github/docker/docker-compose.yml
@@ -4,13 +4,19 @@ services:
mongo:
image: mongo:4.4
- test:
+ test-backend:
build:
context: ../../
- dockerfile: .github/docker/Dockerfile
- image: caronte-test
+ dockerfile: .github/docker/Dockerfile-backend
+ image: caronte-test-backend
depends_on:
- mongo
environment:
MONGO_HOST: mongo
MONGO_PORT: 27017
+
+ test-frontend:
+ build:
+ context: ../../
+ dockerfile: .github/docker/Dockerfile-frontend
+ image: caronte-test-frontend