Skip to content

Commit

Permalink
Enables a demo using Docker to be ran locally
Browse files Browse the repository at this point in the history
This commit adds a Dockerfile and entrypoint in
the lib/demo folder, as well as useful documentation
in the README file.

This demo allows users to test out the latest version
of solidus using Docker locally. This setup is very
flexible and provides another option besides using
Heroku or manually installing everything.
  • Loading branch information
kinduff committed Mar 13, 2019
1 parent 3aa74e7 commit e12e9ff
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ Try out Solidus with one-click on Heroku:

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/solidusio/solidus)

Alternatively, you can use Docker to run a demo on your local machine. Run the
following command to download the image and run it at
[http://localhost:3000](http://localhost:3000).

```
docker run --rm -it -p 3000:3000 solidusio/solidus-demo:latest
```

The admin interface can be accessed at
[http://localhost:3000/admin/](http://localhost:3000/admin/), the default
credentials are `admin@example.com` and `test123`.

## Getting started

Begin by making sure you have
Expand Down
21 changes: 21 additions & 0 deletions lib/demo/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# This image is intended to be used to test and demo Solidus
# it is not intended for production purposes
#
FROM ruby:2.5.1

RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -

RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs

RUN mkdir /solidus

WORKDIR /solidus

ADD . /solidus

RUN bundle install

RUN bundle exec rake sandbox

CMD ["sh", "./lib/demo/docker-entrypoint.sh"]
27 changes: 27 additions & 0 deletions lib/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Solidus Docker Demo
The Dockerfile in this folder is intended for demoing purposes, meaning that a
user can run an installation of Solidus using a Docker container.

## How to build the image
Make sure Docker is installed in your local and run the following command:

```shell
docker build -t solidusio/solidus-demo:latest -f lib/demo/Dockerfile .
```

## How to run the image
You can either run the image you built locally or run the official image pushed
in Dockerhub.

```shell
docker run --rm -it -p 3000:3000 solidusio/solidus-demo:latest
```

## How to push the image
If you want to push the image you can use the following command, just note that
this specific command will push the image to the official Solidus Dockerhub
account.

```shell
docker push solidusio/solidus-demo:latest
```
6 changes: 6 additions & 0 deletions lib/demo/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

export RAILS_ENV=development

cd sandbox && \
bundle exec rails s -p 3000 -b '0.0.0.0'

0 comments on commit e12e9ff

Please sign in to comment.