Skip to content

Commit

Permalink
Merge pull request thrasher-corp#100 from Betazoid/docker-setup
Browse files Browse the repository at this point in the history
Docker setup
  • Loading branch information
thrasher- authored Mar 3, 2018
2 parents 25514b2 + cf1d8b2 commit 4b98f01
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 14 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
.idea
doc
web
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
FROM golang:onbuild
COPY config_example.json config.json
FROM golang:1.9.4 as build
WORKDIR /go/src/github.com/thrasher-/gocryptotrader
COPY . .
RUN mv -vn config_example.json config.json \
&& go get -v -d \
&& GOARCH=386 GOOS=linux CGO_ENABLED=0 go install -v \
&& mv /go/bin/linux_386 /go/bin/gocryptotrader

FROM alpine:latest
COPY --from=build /go/bin/gocryptotrader /app/
COPY --from=build /go/src/github.com/thrasher-/gocryptotrader/config.json /app/
EXPOSE 9050
CMD ["/app/gocryptotrader"]
26 changes: 14 additions & 12 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
version: '2'
version: '3'

services:
web:
build: web/
hostname: gocryptotraderweb
container_name: web
ports:
- "3333:80"
cli:
build: .
hostname: gocryptotrader
container_name: daemon
privileged: true

web:
build: ./web
depends_on:
- cli
ports:
- "9051:80"

cli:
build: .
ports:
- "9050:9050"
2 changes: 2 additions & 0 deletions web/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.git
17 changes: 17 additions & 0 deletions web/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:9-alpine as build
COPY package.json package-lock.json ./
RUN npm set progress=false \
&& npm config set depth 0 \
&& npm cache clean --force
RUN npm i \
&& mkdir /app \
&& cp -R ./node_modules /app
WORKDIR /app
COPY . .
RUN $(npm bin)/ng build --prod --build-optimizer

FROM nginx:1.13.3-alpine
RUN rm -rf /var/www/html/*
COPY nginx/default.conf /etc/nginx/conf.d/
COPY --from=build /app/dist /var/www/html
CMD ["nginx", "-g", "daemon off;"]
20 changes: 20 additions & 0 deletions web/nginx/default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
server {
listen 80;
sendfile on;
default_type application/octet-stream;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;

root /var/www/html;

location / {
try_files $uri $uri/ /index.html =404;
}

}

0 comments on commit 4b98f01

Please sign in to comment.