-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1223 from dradis/kamal
Dockerize the repo
- Loading branch information
Showing
6 changed files
with
89 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
# Ignore git directory. | ||
/.git | ||
|
||
# Ignore bundle config. | ||
/.bundle | ||
|
||
# Ignore environment and deployment files. | ||
/.env* | ||
/.kamal/* | ||
/config/deploy.yml | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
# Ignore pidfiles. | ||
/tmp/pids/* | ||
!/tmp/pids/.keep | ||
|
||
# Ignore storage. | ||
/storage/* | ||
!/storage/.keep | ||
/tmp/storage/* | ||
!/tmp/storage/.keep | ||
|
||
# Ignore assets. | ||
/public/assets | ||
|
||
# Ignore applicaiton folders | ||
/attachments/ | ||
/config/shared/* | ||
/db/*.sqlite3 | ||
/templates/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# We're sticking to non-slim version: https://hub.docker.com/_/ruby/ | ||
FROM --platform=amd64 ruby:3.1.2 | ||
|
||
WORKDIR /app | ||
|
||
# Copying dradis-ce app | ||
COPY . . | ||
|
||
# Copying sample files | ||
COPY config/database.yml.template config/database.yml | ||
COPY config/smtp.yml.template config/smtp.yml | ||
|
||
# Preparing application folders | ||
RUN mkdir -p attachments/ | ||
RUN mkdir -p config/shared/ | ||
RUN mkdir -p templates/ | ||
|
||
# Is this only needed because M1 build? | ||
RUN bundle config build.ffi --enable-libffi-alloc | ||
|
||
# Installing dependencies | ||
RUN bundle install | ||
|
||
# Run and own only the runtime files as a non-root user for security | ||
RUN useradd rails --create-home --shell /bin/bash && \ | ||
chown -R rails:rails attachments config/shared db log tmp templates | ||
USER rails:rails | ||
|
||
# Preparing database | ||
RUN bin/rails db:prepare | ||
#RUN bin/rails db:seed | ||
|
||
# Entrypoint prepares the database. | ||
# ENTRYPOINT ["/app/bin/docker-entrypoint"] | ||
|
||
# Start the server by default, this can be overwritten at runtime | ||
EXPOSE 3000 | ||
# CMD ["./bin/rails", "server"] | ||
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters