-
Notifications
You must be signed in to change notification settings - Fork 58
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
Docker configs sync #602
base: master
Are you sure you want to change the base?
Docker configs sync #602
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,15 @@ | ||
.env | ||
|
||
/tmp/* | ||
/log/*.log | ||
|
||
/vendor/bundle | ||
.bundle | ||
|
||
.bash_history | ||
.byebug_hist | ||
.pry_history | ||
|
||
docker-compose.yml | ||
|
||
.semaphore-cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
###################### | ||
# Stage: Builder | ||
FROM ruby:2.7.1-alpine as Builder | ||
|
||
ARG BUNDLER_VERSION | ||
|
||
RUN apk add --update --no-cache \ | ||
build-base \ | ||
postgresql-dev \ | ||
git \ | ||
nodejs \ | ||
npm \ | ||
imagemagick \ | ||
tzdata | ||
|
||
# Remove bundle config if exist | ||
RUN rm -f .bundle/config | ||
|
||
RUN gem install bundler:$BUNDLER_VERSION | ||
|
||
WORKDIR /app | ||
|
||
# Install gems | ||
ARG BUNDLE_WITHOUT | ||
ENV BUNDLE_WITHOUT ${BUNDLE_WITHOUT} | ||
|
||
RUN bundle config set without ${BUNDLE_WITHOUT} | ||
|
||
COPY Gemfile* /app/ | ||
RUN bundle install -j4 --retry 3 \ | ||
# Remove unneeded files (cached *.gem, *.o, *.c) | ||
&& rm -rf /usr/local/bundle/cache/*.gem \ | ||
&& find /usr/local/bundle/gems/ -name "*.c" -delete \ | ||
&& find /usr/local/bundle/gems/ -name "*.o" -delete | ||
|
||
RUN npm install -g yarn && yarn install | ||
|
||
# Add the Rails app | ||
COPY . /app/ | ||
|
||
# Remove folders not needed in resulting image | ||
ARG FOLDERS_TO_REMOVE | ||
RUN rm -rf $FOLDERS_TO_REMOVE | ||
|
||
############################### | ||
# Stage Final | ||
FROM ruby:2.7.1-alpine as Final | ||
|
||
# Add Alpine packages | ||
RUN apk add --update --no-cache \ | ||
postgresql-client \ | ||
imagemagick \ | ||
tzdata \ | ||
file \ | ||
git \ | ||
nodejs \ | ||
npm | ||
|
||
# Copy app with gems from former build stage | ||
COPY --from=Builder /usr/local/bundle/ /usr/local/bundle/ | ||
COPY --from=Builder /app/ /app/ | ||
|
||
WORKDIR /app |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
if [ -f tmp/pids/server.pid ]; then | ||
rm tmp/pids/server.pid | ||
fi | ||
|
||
bundle exec rails server -b 0.0.0.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env sh | ||
|
||
set -e | ||
|
||
gem install docker-sync | ||
docker-sync start | ||
cp docker-compose.osx.yml docker-compose.override.yml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "3.4" | ||
|
||
services: | ||
app: | ||
volumes: | ||
- .:/app |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: "3.4" | ||
|
||
services: | ||
app: | ||
volumes: | ||
- app-files:/app:nocopy | ||
|
||
volumes: | ||
app-files: | ||
external: true |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,50 @@ | ||||
version: "3.4" | ||||
|
||||
x-app: &app_base | ||||
depends_on: | ||||
- db | ||||
image: ${IMAGE_NAME} | ||||
environment: | ||||
- DATABASE_URL=postgres://postgres:password@db | ||||
- RAILS_ENV | ||||
- RACK_ENV | ||||
- DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL | ||||
- AUTH_SECRET_TOKEN | ||||
- MAILER_SENDER_ADDRESS | ||||
- PASSWORD_RECOVERY_LINK_TEMPLATE | ||||
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 guess this variable isn't need in this project
Suggested change
|
||||
build: | ||||
context: . | ||||
args: | ||||
- BUNDLE_WITHOUT="${BUNDLE_WITHOUT}" | ||||
- BUNDLER_VERSION=2.1.4 | ||||
- FOLDERS_TO_REMOVE="" | ||||
links: | ||||
- db | ||||
volumes: | ||||
- ruby-bundle:/usr/local/bundle | ||||
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. Maybe also use separate volume for |
||||
|
||||
services: | ||||
db: | ||||
image: postgres:12-alpine | ||||
environment: | ||||
- POSTGRES_PASSWORD=password | ||||
ports: | ||||
- "5432:5432" | ||||
volumes: | ||||
- db-data:/var/lib/postgresql/data | ||||
mailcatcher: | ||||
image: yappabe/mailcatcher | ||||
ports: | ||||
- "1025:1025" | ||||
- "1080:1080" | ||||
app: | ||||
<<: *app_base | ||||
depends_on: | ||||
- mailcatcher | ||||
ports: | ||||
- "3000:3000" | ||||
command: bin/docker-entrypoint | ||||
|
||||
volumes: | ||||
ruby-bundle: | ||||
db-data: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "2" | ||
syncs: | ||
app-files: | ||
notify_terminal: true | ||
src: './' | ||
sync_excludes: ['.git', '.bundle'] |
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.
Could you please add this variable to
.env.example
? Something like this: