Skip to content

Commit

Permalink
Fix permisiions to writable folders.
Browse files Browse the repository at this point in the history
  • Loading branch information
khustochka committed May 3, 2024
1 parent ef764e8 commit dd0fd39
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
6 changes: 4 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
.git
tmp
!tmp/pids
tmp/**/*
!tmp/pids/.keep
log
public/assets
app/assets/builds/*
.bundle
storage/**/*
!storage/.keep

Dockerfile
docker-compose.yml
Expand Down
21 changes: 14 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ ENV MALLOC_CONF="dirty_decay_ms:1000,narenas:2,background_thread:true,stats_prin
ENV RUBY_YJIT_ENABLE="1"

# copy with installed gems (in vendor folder)
COPY --from=gems /app /app
COPY --from=gems /app/vendor/bundle /app/vendor/bundle
# commented out after switch from fullstaq. Explore if this is needed.
# COPY --from=gems /usr/local/bin/ruby /usr/local/bin/ruby
# COPY --from=gems /usr/local/bundle /usr/local/bundle
Expand All @@ -143,13 +143,20 @@ COPY --from=assets /app/public/assets /app/public/assets
# Deploy your application
COPY . .

# Adjust binstubs to run on Linux and set current working directory
# This seems unnecessary
# RUN chmod +x /app/bin/* && \
# sed -i 's/ruby.exe/ruby/' /app/bin/* && \
# sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/*
# # Adjust binstubs to run on Linux and set current working directory
# # This seems unnecessary
# # RUN chmod +x /app/bin/* && \
# # sed -i 's/ruby.exe/ruby/' /app/bin/* && \
# # sed -i '/^#!/aDir.chdir File.expand_path("..", __dir__)' /app/bin/*

# Adopted from bitnami/nginx image
VOLUME ["/app/storage"]
VOLUME ["/app/tmp"]

RUN chown -R 1001 /app/storage
RUN chown -R 1001 /app/tmp

# Adopted from bitnami/nginx image
# Left for compatibility
RUN chmod g+rwX /app/tmp
RUN chmod g+rwX /app/tmp/pids
RUN chmod g+rwX /app/storage
Expand Down
19 changes: 9 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
QUAILS_ADMIN_USERNAME: admin
# Password: admin
QUAILS_ADMIN_PASSWORD: "$2a$12$2T5ypL1zWAsEc2FK/KMVKOQyZFgZPegUiL3u0/CLWHPiIeBG6cxLq"
DATABASE_URL: postgres://quails:quails@database/quails_docker
DATABASE_URL: postgres://quails:quails@database/quails_production
RAILS_SERVE_STATIC_FILES: "true"
REDIS_CACHE_URL: redis://redis-cache
env_file:
Expand All @@ -22,7 +22,7 @@ services:
- redis-cache
# Placing tmp on a volume is good for local dev, but not required for prod
volumes:
# - rails_app_tmp:/app/tmp
- rails_app_tmp:/app/tmp
- rails_app_storage:/app/storage

good_job:
Expand All @@ -33,7 +33,7 @@ services:
POSTGRES_PASSWORD: quails
RAILS_ENV: production
SECRET_KEY_BASE: 8ed44e73d525a97a10e105cb585094e04975995dac921da790f3b7c1cdbc3b2c
DATABASE_URL: postgres://quails:quails@database/quails_docker
DATABASE_URL: postgres://quails:quails@database/quails_production
REDIS_CACHE_URL: redis://redis-cache
# COUNT: 1
# GOOD_JOB_POLL_INTERVAL: 5
Expand All @@ -45,16 +45,15 @@ services:
- database
- redis-cache
volumes:
# - rails_app_pids:/app/tmp/pids
# - rails_app_tmp:/app/tmp
- rails_app_tmp:/app/tmp
- rails_app_storage:/app/storage

database:
image: bitnami/postgresql:15-debian-12
environment:
POSTGRES_USER: quails
POSTGRES_PASSWORD: quails
POSTGRES_DB: quails_docker
POSTGRES_DB: quails_production
ports:
- "5499:5432"
volumes:
Expand All @@ -73,8 +72,8 @@ volumes:
db_data15:
cache_data:
rails_app_storage:
rails_app_tmp:
# rails_app_pids:
# rails_app_tmp:
# driver_opts:
# type: tmpfs
# device: tmpfs
# driver_opts:
# type: tmpfs
# device: tmpfs

0 comments on commit dd0fd39

Please sign in to comment.