Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.idea/
client/node_modules/
client/js/app.js
client/js/vendor.js
client/js/index.html
server/cmd/*.exe
server/cmd/logs/
server/cmd/tmp/

# Compiled source #
###################
*.class
*.dll
*.exe
*.o
*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases #
######################
*.log
*.sql
*.sqlite

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.idea/
node_modules/
client/node_modules/
client/js/app.js
client/js/vendor.js
client/js/index.html
Expand Down
70 changes: 43 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,51 @@
FROM ubuntu:18.04
MAINTAINER Luca Moser <[email protected]>
FROM golang:latest

# install zeromq
RUN apt-get update && apt-get install -y wget libtool pkg-config build-essential autoconf automake uuid-dev
RUN cd /opt && wget https://github.com/zeromq/libzmq/releases/download/v4.2.2/zeromq-4.2.2.tar.gz \
&& tar xvzf zeromq-4.2.2.tar.gz \
&& cd zeromq-4.2.2 && ./configure \
&& make install && ldconfig
ENV ZMQ_VERSION 4.1.4

# create client directories
RUN mkdir -p /app/assets/css && mkdir -p /app/assets/html \
&& mkdir -p /app/assets/js && mkdir -p /app/assets/img
# Install needed packages
RUN apt-get update && apt-get install -y --fix-missing \
curl \
libtool \
pkg-config \
lxc \
build-essential \
autoconf \
automake \
&& mkdir -p /tmp/zeromq \
&& curl -SL http://download.zeromq.org/zeromq-$ZMQ_VERSION.tar.gz | tar zxC /tmp/zeromq \
&& cd /tmp/zeromq/zeromq-$ZMQ_VERSION/ \
&& ./configure --without-libsodium \
&& make \
&& make install \
&& ldconfig \
&& rm -rf /tmp/zeromq \
&& apt-get purge -y \
curl \
libtool \
build-essential \
autoconf \
automake \
&& apt-get clean && apt-get autoclean && apt-get -y autoremove

# create server directories
RUN mkdir -p /app/configs && mkdir -p /app/logs
# Install Node.js
RUN apt-get update && apt-get install -y --fix-missing \
curl \
sudo \
&& curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash - \
&& sudo apt-get install -y nodejs

# copy server assets
COPY server/cmd/visualizer /app/visualizer
COPY server/cmd/configs/app_prod.json /app/configs/app.json
COPY server/cmd/configs/network_prod.json /app/configs/network.json
# Build server
COPY ./server /app/server
WORKDIR /app/server
RUN go build cmd/app.go

# copy client assets
COPY client/css/* /app/assets/css/
COPY client/img/* /app/assets/img/
COPY client/js/index.html /app/assets/html/index.html
COPY client/js/app.js /app/assets/js/app.js
COPY client/js/vendor.js /app/assets/js/vendor.js
# Build client
COPY ./client /app/client
WORKDIR /app/client
RUN npm install
RUN npm run build:prod

# workdir and ports
WORKDIR /app
EXPOSE 9000

# entrypoint
ENTRYPOINT ["/app/visualizer"]
WORKDIR /app/server/cmd
ENTRYPOINT [ "go", "run", "app.go" ]
Loading