Skip to content
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 build and push to github container registry #1091

Open
floriandulzky opened this issue Dec 15, 2022 · 3 comments
Open

Docker build and push to github container registry #1091

floriandulzky opened this issue Dec 15, 2022 · 3 comments

Comments

@floriandulzky
Copy link

Expected behavior

A github action that creates a docker image and push it automatically to the github container registry (ghcr.io)
See fork: develop...floriandulzky:dradis-ce:feature/docker-build

Did not create a PR yet. Will update the documentation and then make the PR. But I want to make sure this "feature" is in your interest?

@PeterBennink
Copy link

PeterBennink commented Jan 28, 2023

This could be improved further like this:

FROM ruby:3.1.2-slim

ARG APT="-y --no-install-recommends --no-upgrade -o Dpkg::Options::=--force-confnew"

COPY . .
RUN apt update && DEBIAN_FRONTEND=noninteractive apt install $APT build-essential libpq-dev libsqlite3-dev git && \
   ./bin/setup skip-server && \
   # clean image
   DEBIAN_FRONTEND=noninteractive apt $APT remove build-essential gcc libmariadbd-dev libsqlite3-dev make patch wget zlib1g-dev && \
   DEBIAN_FRONTEND=noninteractive apt install $APT libmariadb3 libsqlite3-0 zlib1g && \
   DEBIAN_FRONTEND=noninteractive apt autoremove -y && \
   rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/* && \
   rm -rf /data/development.sqlite3 && \
   rm -rf /vendor/bundle/ruby/3.1.0/cache /usr/local/bundle/cache

CMD ["ruby", "bin/rails", "server", "-b", "0.0.0.0"]

This reduces the image size from 1.5GB to 850MB.

@etdsoft
Copy link
Member

etdsoft commented Mar 27, 2024

We've made some progress and added a https://github.com/dradis/dradis-ce/blob/develop/Dockerfile any thoughts?

@floriandulzky
Copy link
Author

We've made some progress and added a https://github.com/dradis/dradis-ce/blob/develop/Dockerfile any thoughts?

I think you also could use FROM ruby:3.1.2-slim (untested) like @PeterBennink suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants