Code Monkey home page Code Monkey logo

unit-graphql-ruby's Introduction

Nginx Unit - Ruby GraphQL

Introduction

Docker image based on Alpine Unit Ruby that contains the bare minimum to create a GraphQL Server using Ruby 2.5.1.

Usage

Add this to the top of your Dockerfile:

FROM nater540/unit-graphql-ruby:latest

..Or use a specific tagged version:

FROM nater540/unit-graphql-ruby:1.0.0

Nginx Unit Config

conf.json

{
  "settings": {
    "http": {
      "header_read_timeout": 30,
      "body_read_timeout": 30,
      "send_timeout": 30,
      "idle_timeout": 180,
      "max_body_size": 8388608
    }
  },
  "listeners": {
    "*:3000": {
      "application": "api"
    }
  },
  "applications": {
    "api": {
      "type": "ruby",
      "processes": {
        "max": 10,
        "spare": 5
      },
      "working_directory": "/app/current",
      "script": "/app/current/config.ru"
    }
  }
}

Example Dockerfile

###################################################################################################
# Stage #1 - Create a container for installing gems & any necessary development packages.
# Important: Anything in this stage NOT copied into the final container will be DISCARDED!
###################################################################################################
FROM nater540/unit-graphql-ruby:latest AS build-env

# This container image is setup for production builds by default
# NOTE: This argument is overridden inside `docker-compose.yml` for development!
ARG BUNDLE_WITHOUT='development test'

WORKDIR $INSTALL_PATH

COPY Gemfile Gemfile.lock ./

# Install necessary packages required for bundler to install the project dependencies
RUN apk --no-cache add \
  postgresql-dev \
  libxml2-dev \
  libxslt-dev \
  libffi-dev \
  build-base \
  ruby-dev

# Install gem dependencies and skip any groups specified via `BUNDLE_WITHOUT`
RUN bundle install --jobs 20 --without $BUNDLE_WITHOUT

###################################################################################################
# Stage #2 - Create the final container from the "pure" base image.
###################################################################################################
FROM nater540/unit-graphql-ruby:latest AS final

# Copy the installed gems from the prior stage
COPY --from=build-env $GEM_HOME $GEM_HOME

ADD . .

COPY ./conf.json /opt/unit/state

EXPOSE 3000

unit-graphql-ruby's People

Contributors

nater540 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.