From dfa7a89c91c8794ebb5f4cb1836b91e33ebf106e Mon Sep 17 00:00:00 2001 From: Emiliano Ciavatta Date: Fri, 10 Jul 2020 10:21:19 +0200 Subject: Update docker scripts --- Dockerfile | 4 ++++ Dockerfile.env | 11 +++++++++-- docker-compose.yml | 2 +- frontend/.dockerignore | 21 +++++++++++++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 frontend/.dockerignore diff --git a/Dockerfile b/Dockerfile index 4f90ef8..4d5bda3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,13 @@ FROM eciavatta/caronte-env:latest +ENV GIN_MODE release + COPY . /caronte WORKDIR /caronte RUN go mod download && go build +RUN npm i --global yarn && cd frontend && yarn install && yarn build + CMD ./caronte diff --git a/Dockerfile.env b/Dockerfile.env index 5c00d32..e30663f 100644 --- a/Dockerfile.env +++ b/Dockerfile.env @@ -3,7 +3,9 @@ FROM ubuntu:18.04 ENV RAGEL_VERSION 6.10 ENV HYPERSCAN_VERSION 5.2.1 ENV GO_VERSION 1.14.1 -ENV PATH /usr/local/go/bin:$PATH +ENV NODE_VERSION v12.18.2 +ENV NODE_DISTRO linux-x64 +ENV PATH /usr/local/lib/nodejs/node-$NODE_VERSION-$NODE_DISTRO/bin:/usr/local/go/bin:$PATH # Install tools and libraries RUN apt-get update && apt-get install -y git wget make cmake build-essential python3 libpcap-dev pkg-config @@ -22,7 +24,7 @@ RUN wget http://www.colm.net/files/ragel/ragel-$RAGEL_VERSION.tar.gz -P /tmp && # Get Hyperscan source and install it RUN wget https://github.com/intel/hyperscan/archive/v$HYPERSCAN_VERSION.tar.gz -P /tmp && \ - tar -C /tmp/ -xzf /tmp/v$HYPERSCAN_VERSION.tar.gz && \ + tar -C /tmp/ -xzf /tmp/v$HYPERSCAN_VERSION.tar.gz && \ cd /tmp/hyperscan-$HYPERSCAN_VERSION/ && \ mkdir build && \ cd build && \ @@ -36,6 +38,11 @@ RUN wget https://github.com/intel/hyperscan/archive/v$HYPERSCAN_VERSION.tar.gz - RUN wget https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz -P /tmp && \ tar -C /usr/local -xzf /tmp/go$GO_VERSION.linux-amd64.tar.gz +# Get NodeJs and install it +RUN wget https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-$NODE_DISTRO.tar.xz -P /tmp/ && \ + mkdir -p /usr/local/lib/nodejs && \ + tar -C /usr/local/lib/nodejs -xJf /tmp/node-$NODE_VERSION-$NODE_DISTRO.tar.xz + # Remove source files RUN rm -rf /tmp/* diff --git a/docker-compose.yml b/docker-compose.yml index 5d6813c..0feb831 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,7 +13,7 @@ services: dockerfile: Dockerfile image: caronte ports: - - "80:3333" + - "3333:3333" depends_on: - mongo networks: diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 0000000..0c43a1c --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,21 @@ +# dependencies +/node_modules +/.pnp +.pnp.js + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* -- cgit v1.2.3-70-g09d2