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

How to install eventmachine #163

Closed
Davidffry opened this issue Oct 10, 2017 · 1 comment
Closed

How to install eventmachine #163

Davidffry opened this issue Oct 10, 2017 · 1 comment

Comments

@Davidffry
Copy link

How install with Docker ruby : alpine 3.6

ruby-mysql2
I did it in my Dockerfile but it's dirty :
image

and

eventmachine
why this? I don't understand XD
When i try without dockerfile everything is ok, here no...
image

thanks for your repply ;-)

@tianon
Copy link
Member

tianon commented Oct 10, 2017

This should do the trick:

FROM ruby:2.4-alpine3.6

RUN apk add --no-cache g++ gcc make musl-dev \
	&& gem install eventmachine
$ docker build --pull .
Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM ruby:2.4-alpine3.6
2.4-alpine3.6: Pulling from library/ruby
Digest: sha256:c424eefec1c67b0b065c21233227360f54e713b851b0182980b944446e05f4b4
Status: Image is up to date for ruby:2.4-alpine3.6
 ---> 1e21bb256c62
Step 2/2 : RUN apk add --no-cache g++ gcc make musl-dev 	&& gem install eventmachine
 ---> Running in dc5700df18a5
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
(1/15) Installing libgcc (6.3.0-r4)
(2/15) Installing libstdc++ (6.3.0-r4)
(3/15) Installing binutils-libs (2.28-r2)
(4/15) Installing binutils (2.28-r2)
(5/15) Installing gmp (6.1.2-r0)
(6/15) Installing isl (0.17.1-r0)
(7/15) Installing libgomp (6.3.0-r4)
(8/15) Installing libatomic (6.3.0-r4)
(9/15) Installing mpfr3 (3.1.5-r0)
(10/15) Installing mpc1 (1.0.3-r0)
(11/15) Installing gcc (6.3.0-r4)
(12/15) Installing musl-dev (1.1.16-r13)
(13/15) Installing libc-dev (0.7.1-r0)
(14/15) Installing g++ (6.3.0-r4)
(15/15) Installing make (4.2.1-r0)
Executing busybox-1.26.2-r5.trigger
OK: 184 MiB in 45 packages
Building native extensions.  This could take a while...
Successfully installed eventmachine-1.2.5
1 gem installed
 ---> 72bcb6e3ac23
Removing intermediate container dc5700df18a5
Successfully built 72bcb6e3ac23

In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow. Thanks!

@tianon tianon closed this as completed Oct 10, 2017
maxcapraro pushed a commit to InnerSourceCommons/archive.innersourcecommons.org that referenced this issue Mar 9, 2020
* Fixed sourcemap property - _config_dev.yml

When trying to run the command `jekyll serve` using `_config_dev.yml`,
it failed with the following error:
  Conversion error: Jekyll::Converters::Scss encountered an error while
  converting 'assets/css/atom.scss': undefined method `to_sym' for true:TrueClass Did
you mean? to_s
------------------------------------------------
Jekyll 4.0.0   Please append `--trace` to the `serve` command
               for any additional information or backtrace.
------------------------------------------------
This happens because in `_config_dev.yml` sourcemap is set to `true`,
while the documentation at
https://github.com/jekyll/jekyll-sass-converter stated the allowed
values are `never`, `always` and `development`.

* Docker based development environment

This commit enables the usage of Docker for setting up a development
environment.

It is an implementation for
InnerSourceCommons/innersourcecommons.org#91

With this development, with the command `docker-compose up`, a docker
image is built and a docker contain is run serving the webpage, that
can be accessed on https://localhost:4000

Files:
- `.dockerignore` - ensures that only the necessary files are used in
the context passed to the docker image build, saving build time
- `Dockerfile` - The commands used to build a docker image
- `docker-compose.yml` - Configuration for docker-compose, that enables
a simple development environment setup, automating the image build and
container orchestration

Known limitations:
- Website is not rebuilt automatically when a file is changed, requiring
a container restart (this was expected to work out of the box with
`jekyll serve`, but testing showed it did not work)
- Docker Toolbox is not supported - with this version of docker, the
page can be loaded, but assets are not loaded, as the browser tries to
fetch them from http://0.0.0.0, and the website must be accessed on the
IP returned by `docker-machine ip`. More investigation is necessary.

Explanations:
- `RUN apk add --no-cache g++ gcc make musl-dev` - necessary for
building gem native extensions (eventmachine) - Error message "You have
to install development tools first."
- `RUN bundle update --bundler` - Image build on Docker Toolbox worked
without this, but when trying to build the image on Docker for Mac, it
raised the following error: `find_spec_for_exe': Could not find
'bundler' (1.16.1) required by your /InnerSource/Gemfile.lock.
(Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle
update --bundler`.
- `--host 0.0.0.0` - without this line, jekyll will only accept traffice
incoming from `localhost` or `127.0.0.1`, which is not the case when
using Docker for Mac or Docker Toolbox, as it forwards traffic from the host to the
container. Without this line, the browser will show errors
ERR_CONNECTION_REFUSED (Toolbox) or ERR_EMPTY_RESPONSE (Mac).

Remarks:
- Only tested on Docker for Mac and Docker Toolbox

References:
- https://hub.docker.com/_/ruby
- https://docs.docker.com/engine/reference/builder/#dockerignore-file
- https://docs.docker.com/engine/reference/builder/
- docker-library/ruby#163 (How to install
eventmachine)
-
https://stackoverflow.com/questions/41485217/mount-current-directory-as-a-volume-in-docker-on-windows-10
-
https://stackoverflow.com/questions/42893475/how-to-run-jekyll-serve-pointing-to-another-directory
-
https://stackoverflow.com/questions/50540721/docker-toolbox-error-response-from-daemon-invalid-mode-root-docker
-
https://medium.com/@Charles_Stover/fixing-volumes-in-docker-toolbox-4ad5ace0e572
-
https://sashabrava.github.io/2018/making-Jekyll-available-on-local-network.html
- microsoft/vscode-remote-release#764
-
https://stackoverflow.com/questions/16608466/connect-to-a-locally-built-jekyll-server-using-mobile-devices-in-the-lan/16608698

* Docker support enhancement

Added future proof support to Docker for windows
with setting `JEKYLL_ENV` to a value different than
`development`.
With this setting, the ip used in `--host` is not
going to override site.url.
The alternative would be use `build --watch` + a separate
web server for static files, but I did not see any advantage,
and also I wanted to have the livereload option of `serve`.

Added comments on the Dockerfile to explain some
of the non-intuitive parts.

Added support for livereload.

Added EXPOSE statements to the Dockerfile to document ports in use.

References:
- https://jekyllrb.com/docs/configuration/options/#serve-command-options
- https://tonyho.net/jekyll-docker-windows-and-0-0-0-0/
- Cannot set site.url to a different address than the --host flag address in development
  - jekyll/jekyll#5743
- https://docs.docker.com/engine/reference/builder/#expose

* Docker Toolbox enablement

This commit enables the usage of Docker Toolbox with the command
`docker-compose -f docker-compose-toolbox.yml up`.

A similar result could be achieved by editing `_config_dev.yml`
to have 'url':'' and tweak the Dockerfile command to include
the --force_polling option, but I did not want to change the
`_config_dev.yml` without being sure of the consequences for
non docker users.

* Page edit tests documentation

I added a section in CONTRIBUTING.md on how to test the page
edits locally, with and without docker.

So far the instructions only covered testing the build locally,
but not how to serve the page while editing.

Co-authored-by: Guilherme Dellagustin <[email protected]>
lenucksi added a commit to InnerSourceCommons/archive.innersourcecommons.org that referenced this issue Mar 16, 2020
* Fixed sourcemap property - _config_dev.yml

When trying to run the command `jekyll serve` using `_config_dev.yml`,
it failed with the following error:
  Conversion error: Jekyll::Converters::Scss encountered an error while
  converting 'assets/css/atom.scss': undefined method `to_sym' for true:TrueClass Did
you mean? to_s
------------------------------------------------
Jekyll 4.0.0   Please append `--trace` to the `serve` command
               for any additional information or backtrace.
------------------------------------------------
This happens because in `_config_dev.yml` sourcemap is set to `true`,
while the documentation at
https://github.com/jekyll/jekyll-sass-converter stated the allowed
values are `never`, `always` and `development`.

* Docker based development environment

This commit enables the usage of Docker for setting up a development
environment.

It is an implementation for
InnerSourceCommons/innersourcecommons.org#91

With this development, with the command `docker-compose up`, a docker
image is built and a docker contain is run serving the webpage, that
can be accessed on https://localhost:4000

Files:
- `.dockerignore` - ensures that only the necessary files are used in
the context passed to the docker image build, saving build time
- `Dockerfile` - The commands used to build a docker image
- `docker-compose.yml` - Configuration for docker-compose, that enables
a simple development environment setup, automating the image build and
container orchestration

Known limitations:
- Website is not rebuilt automatically when a file is changed, requiring
a container restart (this was expected to work out of the box with
`jekyll serve`, but testing showed it did not work)
- Docker Toolbox is not supported - with this version of docker, the
page can be loaded, but assets are not loaded, as the browser tries to
fetch them from http://0.0.0.0, and the website must be accessed on the
IP returned by `docker-machine ip`. More investigation is necessary.

Explanations:
- `RUN apk add --no-cache g++ gcc make musl-dev` - necessary for
building gem native extensions (eventmachine) - Error message "You have
to install development tools first."
- `RUN bundle update --bundler` - Image build on Docker Toolbox worked
without this, but when trying to build the image on Docker for Mac, it
raised the following error: `find_spec_for_exe': Could not find
'bundler' (1.16.1) required by your /InnerSource/Gemfile.lock.
(Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle
update --bundler`.
- `--host 0.0.0.0` - without this line, jekyll will only accept traffice
incoming from `localhost` or `127.0.0.1`, which is not the case when
using Docker for Mac or Docker Toolbox, as it forwards traffic from the host to the
container. Without this line, the browser will show errors
ERR_CONNECTION_REFUSED (Toolbox) or ERR_EMPTY_RESPONSE (Mac).

Remarks:
- Only tested on Docker for Mac and Docker Toolbox

References:
- https://hub.docker.com/_/ruby
- https://docs.docker.com/engine/reference/builder/#dockerignore-file
- https://docs.docker.com/engine/reference/builder/
- docker-library/ruby#163 (How to install
eventmachine)
-
https://stackoverflow.com/questions/41485217/mount-current-directory-as-a-volume-in-docker-on-windows-10
-
https://stackoverflow.com/questions/42893475/how-to-run-jekyll-serve-pointing-to-another-directory
-
https://stackoverflow.com/questions/50540721/docker-toolbox-error-response-from-daemon-invalid-mode-root-docker
-
https://medium.com/@Charles_Stover/fixing-volumes-in-docker-toolbox-4ad5ace0e572
-
https://sashabrava.github.io/2018/making-Jekyll-available-on-local-network.html
- microsoft/vscode-remote-release#764
-
https://stackoverflow.com/questions/16608466/connect-to-a-locally-built-jekyll-server-using-mobile-devices-in-the-lan/16608698

* Removed absolute path usage from _head.html

Co-authored-by: Johannes Tigges <[email protected]>
kaushikgopal pushed a commit to kaushikgopal/jekyll-docker-blog-build that referenced this issue Jun 3, 2020
chrissolanilla pushed a commit to chrissolanilla/CSolanillaBio that referenced this issue May 16, 2024
chrissolanilla pushed a commit to chrissolanilla/CSolanillaBio that referenced this issue May 16, 2024
Update titles for brandon and corey

Closes docker-library#163

See merge request ucfcdl/static-sites/techrangers-website!251
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants