Commit graph

22 commits

Author SHA1 Message Date
Joe Doss
aa49cb1cfe
Bugfix for #7663 and refactor of container setup (#7747)
* Move from Alpine Linux to Fedora Linux.

This changes the base container image away from Alpine Linux to
Fedora Linux to address some musl libc issues with some of our gems.

It also moved the main file to a Containerfile and symlinks the Dockerfile
to it. This makes our container setup less Docker-centric as Linux users
most likely will be using Podman as their container runtime.

Lastly, it moves the WORKDIR from /usr/src/app to /opt/apps/devto.
The Linux FHS states that /opt is the spot for Optional application
software packages and /usr/src is for kernel source code.

https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

/opt Optional application software packages
/usr/src Source code, e.g., the kernel source code with its header files.

Also, if SELinux becomes a thing in our future, moving this makes it
easier to manage contexts out of /opt rather than /usr/src.

* Adjust the Containerfile a bit to add some missing packages, make it
more generic and move env vars to the docker-compose.

* Move the Dockerfile to a symlink to the Containerfile.

We need to be able to support more than just Docker for a container
runtime. Moving everything to a Containerfile and symlinking the
Dockerfile helps users run runtimes such as Podman.

* Add in new entrypoint files and fix the app path in docker-entrypoint.sh

* Refactor the docker-compose.yml file so it doesn't build the main
application container three times in a row. We can use the same
container for web, webpacker, and sidekiq.

Also make the volume names very explicit on what their contents and add
in SELinux context support with :Z

* Fix ELASTICSEARCH_URL.

* Remove the absolute path on ip binary and add in iproute to Containerfile.

* Symlink the Dockerfile to Containerfile and add in a container-compose.yml file
for usage with podman-compose. We are waiting for this issue to get resolved

https://github.com/containers/libpod/issues/6153

and for podman-compose to mature a bit more. A user using podman-compose can use

podman-compose -f container-compose.yml

to launch the DEV container stack with Podman.

* Update the .gitignore file to reflect the new container volumes.

* Fix the entrypoint script on the Containerfile and clean up a bunch of things.

* Rework the Containerfile to prep it to run as a non-root user. We have to wait
for this issue to get fixed:

https://github.com/containers/libpod/issues/6153

for Linux users and then we can uncomment the USER line so we are running Rails
as a non-root user. :toot:

* This reworks the compose files so each task that is needed to start the app has
a correct wait command with dockerize. It also adds in containers for doing
yarn and bundle things for development. Since we mount the code directory inside
the container we lose our pre-containerized gems and node_modules.

This means users can run:

Linux
podman-compose -f container-compose.yml up

Mac
docker-compose up

and it should correctly build the app stack with containers!

* Clean up old container related things.

* Add in some container pre-reqs and my name to the "Core team" section! :toot:

* Adjust the seed and sidekiq compose entries so they do not use the web entrypoint
and set the REDIS_URL and REDIS_SESSIONS_URL env vars for seed.

Add in some echos to the entrypoint.sh.

Also set docker-compose to use :delegated on mount points to speed things up.

https://docs.docker.com/storage/bind-mounts/#configure-mount-consistency-for-macos

* Just call yarn install --dev on the yarn container.

* Update documentation to support Docker and Podman as Container Engines and
move the page from docker to containers to reflect the fact not all users run
their containers via Docker.

There are dozens of us... DOZENS!

* Set --local on bundle config so it just impacts this Ruby app.

* Renamed bin/docker-setup to bin/container-setup to reflect the fact that that
we can use Podman as a container engine. I also refactored it so it does some
basic pre-flight checks for docker and docker-compose or podman and
podman-compose to make sure users have a container engine installed.

* Set cache_all_platforms true for bundler.

* Bump docker-compose dockerize -timeout to 45min for slower macOS hardware.

* Move to the consolidated app_initializer:setup rake task for bootstrapping the
app.

* Update docs/installation/readme.md
2020-05-28 12:11:51 -05:00
rhymes
db9186043e
Removed yarn integrity check (#7478) 2020-04-23 19:23:12 -04:00
Abenet Tamiru
ab3a416cfc
Respect .yarnrc in Dockerfile (#7297) 2020-04-15 09:55:01 -04:00
Juan Vasquez
80737b5404
Fix Install libcurl and curl-dev into Dockerfile (#7241) 2020-04-13 10:54:23 +02:00
Michael Kohl
741420893a
Add Solargraph gem for Gitpod (#7171) 2020-04-09 15:54:56 +02:00
rhymes
5c17e5c25d
Upgrade Ruby to 2.7.1 (#7097) [deploy]
* Upgrade Ruby to 2.7.1

* Use explicit version in Dockerfile

* Fix docs Gemfile
2020-04-06 18:21:50 +02:00
rhymes
6bede2a92b
Upgrade to Ruby 2.7.0 (#5281) [deploy]
* Upgrade to Ruby 2.7.0

* Upgrade Travis's Ruby as well

* Fix conflict

* Silence all Ruby 2.7 deprecation warnings in dev mode

* Silence dev and test unless CI
2020-04-03 17:36:19 +02:00
briwa
09f0773c18
refactor(docker): move redis env config to docker (#6936)
instead of in config/application.yml
2020-03-30 10:48:38 +07:00
Michael Kohl
d016356d7f
Copy .ruby-version into Dockerfile (#5976) 2020-02-10 17:10:10 -05:00
Asha Balasubramaniam
43bf0f8fa6 [docker] Install less (#5677)
I was unable to fully use pry using the docker version of dev.to.
For instance while trying to examine certain variables or trying to use
`caller` to checkout the backtrace, I would run into the a `multi-call binary error` with
`BusyBox`.

On looking up this error, discovered https://github.com/pry/pry/issues/1248 which also
had the fix which was simply to install less for the docker image.

Verified locally that pry's full functionality works.
2020-01-23 16:38:08 -05:00
WenYu
e3e4a29ac8 Add ImageMagick as one of the dependencies to be installed inside Docker (#4618) 2019-10-28 09:38:18 -04:00
rhymes
89476fae08 Upgrade Ruby to 2.6.5 (#4451) 2019-10-17 09:34:31 -04:00
Hector Bustillos
27a7a199d7 #4129 Reduce Dockerfile size (#4251)
* The previous Dockerfile was using and outdated format and was causing
heavy load times.

The number of the lines in the Dockerfile are defined as layer, with more
layers more time and bigger is the final image.

There were many things that were able to be delegated to the official ruby
docker image.

*  - Use yarn community package
 - Don't create the workdir directory since is created by docker if doesn't exists
 - Remove config/application.yml from .dockerignore

* Update Dockerfile

Co-Authored-By: Abenet Tamiru <mail@abenet.me>

* Update Dockerfile

Co-Authored-By: Abenet Tamiru <mail@abenet.me>

* Add directory copy, and user correct folder in compose

* Update docker-compose and Dockerfile

* Fix typo

Co-Authored-By: Mac Siri <krairit.siri@gmail.com>

* Update wording

Co-Authored-By: Mac Siri <krairit.siri@gmail.com>
2019-10-10 18:01:04 -04:00
Kitten King
6290451273 Fix Typos (#3510) 2019-07-22 12:56:48 -04:00
Mazen Touati
38f1eec56d Fix typos in Dockerfile (#3214) [ci skip] 2019-06-17 16:51:11 -04:00
rhymes
56e13d00f0 Upgrade Ruby to 2.6.3 (#2649) 2019-05-02 12:06:18 -04:00
Eugene Cheah
3104c480c5 Implement docker-run.sh script + docker container build (#1844) [ci skip] 2019-03-18 18:31:39 -04:00
rhymes
dd6372012d Upgrade Ruby to 2.6.1 (#1711)
* Upgrade Ruby to 2.6.1

Ruby 2.6.1 contains a fix for Net::HTTP

* Add 2.6.1 to .ruby-version as well

* Add 2.6.1 to Travis CI as well
2019-02-06 16:48:28 -04:00
Vinicius Stock
0725b85e50 Upgrade to Ruby 2.6.0 (#1482)
* Upgrade to Ruby 2.6.0

* Change Ruby version in guides and in travis

* Upgrade Rubocop

* Change Rubocop version for code climate

* Update .codeclimate.yml

* Update badge
2019-01-09 15:59:38 -05:00
Mac Siri
673b6d0754
Update Dockerfile (#1009) [ci skip] 2018-10-25 14:13:27 -04:00
rhymes
47bfe13b57 Update Dockerfile to bundler before installing packages (#961) [ci skip]
I just tried going through the Docker installation guide and I got the following warning:

> Warning: the running version of Bundler (1.16.3) is older than the version that created the lockfile (1.16.6). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.

This way the build should always use the latest version of Bundler
2018-10-19 12:38:03 -04:00
Michael
cfda390845 Adds optional support for Docker/Compose (#296)
* Adds optional support for Docker/Compose

* Upgrades Dockerfile to use a multi-stage build

* Gets rest of stack running in Docker

* Renames queue to jobs, uses jobs namespace command

* Reverts file

* Adds webpacker

* Fixes yarn check issue

* Adds Database URL default connection string

* Remove daemons gem

* Update huskyhook config

* Update seed.rb

* Create .dockerignore

* Increase RackTimeout's config

* Simplify Docker config

* Update README

* Remove postgres url default

* Change docker entry point to 3000

* Remove duped integrity setting
2018-10-12 11:48:53 -04:00