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

Understanding your Dockerfile - New Dockerfile proposal #169

Open
ylacaute opened this issue Nov 25, 2019 · 6 comments
Open

Understanding your Dockerfile - New Dockerfile proposal #169

ylacaute opened this issue Nov 25, 2019 · 6 comments

Comments

@ylacaute
Copy link

ylacaute commented Nov 25, 2019

This issue is more an information request than a feature request.
I don't understand why your Dockerfile is playing with git, gcc and so on, which is too complicated.

As you are building a ruby package, what about a Dockerfile like this :

FROM ruby:2.5.7-buster

RUN set -ex \
    && gem install hiptest-publisher

RUN mkdir /app
WORKDIR /app
VOLUME /app

ENTRYPOINT ["hiptest-publisher"]
@cbliard
Copy link
Contributor

cbliard commented Nov 25, 2019

The libs are needed to compile some extensions like nokogiri. The goal is to keep the final image size small so it is using them and uninstalling them at the end. And you are right, the final Dockerfile to do this is complicated.

Also, the goal is to use the hiptest-publisher from the source, so that a local modification will be picked up when building the docker image. With the Dockerfile you provided, the hiptest-publisher is installed from rubygems, meaning it is the last released one, whereas I would expect to get one built from the current sources.

Does it make sense now?

@ylacaute
Copy link
Author

Yes I understand better, this is a convenient way to build whatever version of hiptest publisher from source, without depending on the gem package.
I still don't get it for the git commit inside and why you would need to recompile a dependency.

In my use case, I would like to build a Docker image with many tools and I can't inherit from the hiptest image. So, I would like to install it from package manager, like in the sample dockerfile above. Btw, this dockerfile is indeed incomplete, it would be better to start from an alpine and add an argument for the version.
By doing this, I thought : "a pipeline could generate automaticaly the publisher gem package and then you could use it in your official dockerfile"

Am I missing something ?

@cbliard
Copy link
Contributor

cbliard commented Nov 25, 2019

this is a convenient way to build whatever version of hiptest publisher from source, without depending on the gem package

Exactly

The need for git commit is from the juwelier tool which creates the gem. It needs a git repository to pull files from so we create one to accomodate it.

@cbliard
Copy link
Contributor

cbliard commented Nov 29, 2019

Sorry, I did not to answer to the part with the pipeline. I'm not familiar with it. What is it?

If you do not need the latest master, I would recommend using the last released version with a RUN gem install hiptest-publisher like you did in your first Dockerfile.

@ylacaute
Copy link
Author

ylacaute commented Nov 29, 2019

By pipeline I would mean Jenkins, your continuous delivery workflow, which could be :

  1. Build + Tests + Git Tag / branch, whatever...
  2. Generate a new Ruby package and publish it
  3. Generate a new Docker image based on this new ruby package version

But I am not familiar with Ruby at all, maybe that is a bad idea or even not possible.

Anyway, for information, I am trying trying to build a POD inside Openshift (kubernetes) which run hiptest-publisher, so I need an image which can be started as "an environment" not as a binary, and this image should contains hiptest and java.

I can't base the image on yours and so I would expect to install it with gem, but it seems more complicated than expected when we speak about Ruby... I can't even specify the version I am using...

Here is my (temporary) dockerfile :

# FINAL SIZE : 180MB

FROM openjdk:8u232-slim-buster

ENV APT_OPTS "-qqy --no-install-recommends --allow-unauthenticated"
ENV BUILD_DEPENDENCIES \
                autoconf \
		automake \
		bzip2 \
		dpkg-dev \
		file \
		g++ \
		gcc \
		imagemagick \
		libbz2-dev \
		libc6-dev \
		libcurl4-openssl-dev \
		libdb-dev \
		libevent-dev \
		libffi-dev \
		libgdbm-dev \
		libglib2.0-dev \
		libgmp-dev \
		libjpeg-dev \
		libkrb5-dev \
		liblzma-dev \
		libmagickcore-dev \
		libmagickwand-dev \
		libmaxminddb-dev \
		libncurses5-dev \
		libncursesw5-dev \
		libpng-dev \
		libpq-dev \
		libreadline-dev \
		libsqlite3-dev \
		libssl-dev \
		libtool \
		libwebp-dev \
		libxml2-dev \
		libxslt-dev \
		libyaml-dev \
		make \
		patch \
		unzip \
		xz-utils \
		zlib1g-dev \
                bison \
		dpkg-dev \
		libgdbm-dev

# INSTALL PACKAGES
RUN apt-get update ${APT_OPTS} \
 && apt-get install ${APT_OPTS} ${BUILD_DEPENDENCIES} ruby ruby-dev curl

# HIPTEST-PUBLISHER
RUN gem install hiptest-publisher

# CLEAN
RUN apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${BUILD_DEPENDENCIES} \
 && rm -rf /var/lib/apt/lists/*

I would appreciate any suggestion to improve this dockerfile (to manage version properly) but don't worry about this, you can close this issue if you want.

@karamosky
Copy link
Contributor

Hi,
Besides ruby version locking, I would recommend using a locked version of hiptest-publisher due to the rapid changes (and maybe breaking ones).

RUN gem install hiptest-publisher -v 1.31.0

You can use this PPA to install a specific ruby version

https://launchpad.net/~brightbox/+archive/ubuntu/ruby-ng

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