Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(docker-compose): add docker-compose #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ethgasstation-api Dockerfile
FROM ubuntu:xenial
FROM ubuntu:bionic

ENV NODE_ENV production
ENV PORT 8080
Expand All @@ -8,7 +8,8 @@ ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y curl
RUN curl -sL https://deb.nodesource.com/setup_9.x | bash -

RUN curl -sL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get install -y nodejs

RUN mkdir -p /opt/ethgasstation/api
Expand All @@ -24,4 +25,4 @@ COPY settings.docker.conf /etc/ethgasstation.conf
RUN cd /opt/ethgasstation/api && npm install

EXPOSE 8080
CMD node /opt/ethgasstation/api/app.js
CMD node /opt/ethgasstation/api/app.js
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ docker build -t ethgasstation-api .
docker run -p 8080:8080 ethgasstation-api
```

A compose.yml is included for deployment as well. To run the Docker compose
with MariaDB, redis and ethgas station API. **(you need to have ethgasstation_backend running and eth-node)**:

```
docker-compose -f compose.yml build
docker-compose -f compose.yml up
```

This will expose and forward port 8080 from the image. Note that the docker
image runs in production mode by default.

Expand Down
27 changes: 27 additions & 0 deletions compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use root/example as user/password credentials
version: '3.1'

services:
mariadb:
image: mariadb
restart: always
environment:
MYSQL_USER: ethgas
MYSQL_PASSWORD: station
MYSQL_DATABASE: tx
MYSQL_ROOT_PASSWORD: nopasanada

redis:
image: redis:3.2
container_name: redis

ethgasstation_api:
build:
context: ./
dockerfile: ./Dockerfile
image: ethgasstation-api
ports:
- "8080:8080"
depends_on:
- mariadb
- redis