Evgeny Smyshlyaev
5 years ago
committed by
rozetko
5 changed files with 92 additions and 29 deletions
@ -1,20 +1,12 @@
|
||||
FROM python:3.6.6 |
||||
|
||||
WORKDIR /var/www/analytics |
||||
|
||||
COPY ./requirements.txt /var/www/analytics |
||||
COPY requirements.txt /requirements.txt |
||||
|
||||
RUN pip install -r requirements.txt \ |
||||
&& apt-get update && apt-get install -y \ |
||||
apt-utils \ |
||||
gnupg \ |
||||
curl \ |
||||
make \ |
||||
g++ \ |
||||
git |
||||
RUN pip install -r /requirements.txt |
||||
|
||||
VOLUME [ "/var/www/data" ] |
||||
WORKDIR /var/www/analytics |
||||
|
||||
COPY . /var/www/analytics/ |
||||
|
||||
|
||||
CMD ["python", "-u", "bin/server"] |
||||
|
@ -0,0 +1,49 @@
|
||||
version: '2.1' |
||||
services: |
||||
server: |
||||
image: hastic/server:latest |
||||
build: |
||||
dockerfile: server/Dockerfile |
||||
context: . |
||||
environment: |
||||
|
||||
HASTIC_API_KEY: ${HASTIC_API_KEY?"HASTIC_API_KEY variable is required"} |
||||
GRAFANA_URL: ${GRAFANA_URL?"GRAFANA_URL variable is required"} |
||||
|
||||
HASTIC_DB_CONNECTION_STRING: ${HASTIC_MONGO_USER:-hastic}:${HASTIC_MONGO_PASSWORD:-password}@mongo:27017/${HASTIC_MONGO_DB:-hastic} |
||||
ZMQ_CONNECTION_STRING: ${ZMQ_CONNECTION_STRING:-tcp://analytics:8002} |
||||
|
||||
HASTIC_WEBHOOK_URL: ${HASTIC_WEBHOOK_URL} |
||||
HASTIC_WEBHOOK_TYPE: ${HASTIC_WEBHOOK_TYPE} |
||||
HASTIC_INSTANCE_NAME: ${HASTIC_INSTANCE_NAME} |
||||
HASTIC_WEBHOOK_IMAGE: ${HASTIC_WEBHOOK_IMAGE} |
||||
TIMEZONE_UTC_OFFSET: ${TIMEZONE_UTC_OFFSET} |
||||
|
||||
HASTIC_DB_CONNECTION_TYPE: mongodb |
||||
|
||||
ports: |
||||
- ${HASTIC_PORT:-8000}:8000 |
||||
restart: always |
||||
depends_on: |
||||
- mongo |
||||
|
||||
analytics: |
||||
image: hastic/analytics:latest |
||||
build: analytics |
||||
restart: always |
||||
|
||||
mongo: |
||||
image: mongo:4.2.1-bionic |
||||
environment: |
||||
MONGO_INITDB_ROOT_USERNAME: ${HASTIC_MONGO_ADMIN_USER:-admin} |
||||
MONGO_INITDB_ROOT_PASSWORD: ${HASTIC_MONGO_ADMIN_PASSWORD:-password} |
||||
MONGO_INITDB_DATABASE: ${HASTIC_MONGO_DB:-hastic} |
||||
restart: always |
||||
volumes: |
||||
- hastic_mongo:/data/db |
||||
- hastic_mongo_config:/data/configdb |
||||
- ./mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js:ro |
||||
|
||||
volumes: |
||||
hastic_mongo: |
||||
hastic_mongo_config: |
@ -0,0 +1,12 @@
|
||||
db.createUser( |
||||
{ |
||||
user: "hastic", |
||||
pwd: "password", |
||||
roles: [ |
||||
{ |
||||
role: "readWrite", |
||||
db: "hastic" |
||||
} |
||||
] |
||||
} |
||||
); |
@ -1,23 +1,33 @@
|
||||
FROM python:3.6.6 |
||||
FROM node:8-alpine AS build |
||||
|
||||
RUN apt-get install curl \ |
||||
bash \ |
||||
gnupg \ |
||||
make \ |
||||
g++ \ |
||||
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \ |
||||
&& apt-get update \ |
||||
&& apt-get install nodejs |
||||
# tools for building zeromq |
||||
|
||||
VOLUME [ "/var/www/data" ] |
||||
RUN apk add --no-cache curl gnupg make g++ bash python |
||||
|
||||
COPY . /var/www |
||||
# Note: context starts in directory above (see docker-compose file) |
||||
COPY server /var/www/server |
||||
|
||||
# copy git head file for current branch |
||||
# if nothing specified in `git_branch` arg then whole directory will be copied |
||||
COPY .git/refs/heads /var/www/.git/refs/heads |
||||
|
||||
WORKDIR /var/www/server |
||||
|
||||
RUN npm install |
||||
RUN npm run build |
||||
|
||||
FROM node:8-alpine |
||||
|
||||
# Note: context starts in directory above (see docker-compose file) |
||||
COPY .git/HEAD /var/www/.git/ |
||||
COPY server/package.json /var/www/server/ |
||||
|
||||
WORKDIR /var/www/server |
||||
|
||||
COPY --from=build /var/www/server/dist /var/www/server/dist |
||||
|
||||
VOLUME ["/var/www/data"] |
||||
|
||||
ENV INSIDE_DOCKER true |
||||
|
||||
CMD ["npm", "start"] |
||||
|
Loading…
Reference in new issue