-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
started working on dockerization #3028
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# syntax=docker/dockerfile:1 | ||
FROM ruby:3.1.3 | ||
WORKDIR /crimethinc | ||
COPY . . | ||
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client | ||
|
||
RUN gem install bundler --conservative && gem install os && bundle install | ||
|
||
ENTRYPOINT ["rails", "server"] | ||
|
||
EXPOSE 3000 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
version: '3' | ||
services: | ||
db: | ||
image: postgres | ||
volumes: | ||
- ./tmp/db:/var/lib/postgresql/data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if there's a way to specify this volume at runtime or set it to a more generic path, but we don't want production data to be keep in a |
||
environment: | ||
- POSTGRES_HOST_AUTH_METHOD=trust | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's how I setup my postgres database in local, but I don't know the best practice related to production and security. Myabe it's better to have a separate password for the database. |
||
ports: | ||
- 5432:5432 | ||
web: | ||
image: crimethinc:latest | ||
ports: | ||
- "3000:3000" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here, if you don't setup another docker-compose |
||
links: | ||
- db | ||
environment: | ||
- RAILS_ENV=${RAILS_ENV} | ||
extra_hosts: | ||
- "host.docker.internal:host-gateway" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably want to specify a version of the postgres image since data format are not necessary compatible between version, so if you redeploy and a new version has been release it may not boot because the format have change, and we need to migrate the data first.