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

Add Dockerfile #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add Dockerfile #20

wants to merge 1 commit into from

Conversation

ferryman0608
Copy link

Type of Change: Feature
Explanation: In an effort to support the project's reach and user experience, I've developed a Dockerfile with the aim of streamlining the setup process and ensuring consistent environments across different platforms. This initiative is part of a larger project I'm working on, which leverages large language models to automatically generate Dockerfiles tailored for specific projects.

Usage:
Place the Dockerfile in the root directory of the project;
Run the following command in the root directory of the project to build the image: docker build -t <image_name> . ;
Run the following command to run the container: docker run -it <image_name> bash;

Attached to this PR is the Dockerfile I've proposed. I’m fully open to discussing any aspects of it and am willing to make necessary adjustments to better align with your project's goals and practices.

Thank you very much for considering this contribution.

@ds2643
Copy link

ds2643 commented Apr 4, 2024

I'm not a contributor to this code base, but I hope this review is helpful.

First off, I'm running Ubuntu 22.10. I'm also running Docker version 24.0.5, build ced0996.

Following your instructions, docker builds successfully:

docker build -t sqlite_test .
[+] Building 453.9s (11/11) FINISHED                                   docker:default
 => [internal] load build definition from Dockerfile                             0.0s
 => => transferring dockerfile: 539B                                             0.0s
 => [internal] load .dockerignore                                                0.0s
 => => transferring context: 2B                                                  0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                  0.8s
 => [1/7] FROM docker.io/library/ubuntu:20.04@sha256:80ef4a44043dec4490506e6cc4  7.0s
 => => resolve docker.io/library/ubuntu:20.04@sha256:80ef4a44043dec4490506e6cc4  0.0s
 => => sha256:80ef4a44043dec4490506e6cc4289eeda2d106a70148b74b5 1.13kB / 1.13kB  0.0s
 => => sha256:48c35f3de33487442af224ed4aabac19fd9bfbd91ee90e9471d41 424B / 424B  0.0s
 => => sha256:3cff1c6ff37e0101a08119d0743ba95c7f505d00298f5a169 2.29kB / 2.29kB  0.0s
 => => sha256:17d0386c2fff30a5b92652bbef2b84639dba9b9f17bdbb8 27.51MB / 27.51MB  6.5s
 => => extracting sha256:17d0386c2fff30a5b92652bbef2b84639dba9b9f17bdbb819c8d10  0.4s
 => [2/7] WORKDIR /sqlite                                                        0.1s
 => [3/7] RUN apt-get update && apt-get install -y git                          25.2s
 => [4/7] RUN git clone https://github.com/sqlite/sqlite.git .                 121.8s
 => [5/7] RUN git checkout version-3.45.1                                        0.7s 
 => [6/7] RUN apt-get install -y autoconf automake bison libtool make tcl pkg-  25.9s 
 => [7/7] RUN cd /sqlite && git fetch && git checkout version-3.45.1 && ./con  269.1s 
 => exporting to image                                                           3.3s 
 => => exporting layers                                                          3.3s 
 => => writing image sha256:b8e132d9e7278e722a1979afa61bbaab9d2cefe76e1560fb0c0  0.0s 
 => => naming to docker.io/library/sqlite_test                                   0.0s 

As your instructions suggest, I'm also able to connect to run a shell on the container.

As a new user of this repository, I do find your addition of this Dockerfile to improve my user experience. That being the case, I suggest you copy your documentation from the pull-request message to somewhere more persistent, obviously following contribution standards (which I haven't personally finished reviewing).

As a new user, I'd be very interested in documentation providing a some examples of suggested use patterns. For example, how could I use this docker image in sqlite development? Might this docker support help me use sqlite in another project?

Anyway, awesome work.

tar
RUN cd /sqlite \
&& git fetch \
&& git checkout version-3.45.1 \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there some reason you're checking out this tag twice?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no other reason, simply because this Dockerfile is what we instructed the LLM to generate, and there may be a lack of checking for this step after the build.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dockerfile is what we instructed the LLM to generate

I think there's missing context that you could document in the pull-request message.

FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /sqlite
RUN apt-get update && apt-get install -y git
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't assume you intend this Dockerfile to be distributed as a standalone artifact. Assuming you're fine with this file being stored at the root of this repository, you could just copy the files you need (including git files) and copy those contents into /sqlite. Alternatively, you might assume the developer checks out the tag they want before building the docker image. As a new contributor, I'd be surprised that a particular version is enforced by the Dockerfile.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the features of our tool is that it allows the user to select a specific version when the tool starts running, so this version can be changed.

Copy link

@ds2643 ds2643 Apr 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

our tool

Which tool?

zlib1g-dev \
tcl8.6-dev \
tar
RUN cd /sqlite \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to change directory into /sqlite after already setting WORKDIR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the same reason as mentioned above, what we do is guide the LLM to generate, but it doesn't completely determine what it outputs. The purpose of our job is to help novice users get started with a project quickly.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, so you're using AI to generate this Dockerfile? I guess we really aren't necessary.

&& make \
&& make sqlite3.c \
&& make devtest
EXPOSE 8080
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like a sane default, but should this port be configurable?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This port is a configurable value. It can be specified by the user before the tool starts running. If the user does not specify it, the tool looks for a possible port in the project file, and if it does not find one, it uses the default port. After the Dockerfile is generated, you can also modify the port number according to your needs.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that the configurability of the port is worth documenting.

@ds2643
Copy link

ds2643 commented Apr 4, 2024

@ferryman0608, I noticed that this repository is a mirror. I'm not sure you'll get adequate review from project maintainers. Please correct me if I'm wrong.

@ferryman0608
Copy link
Author

@ferryman0608, I noticed that this repository is a mirror. I'm not sure you'll get adequate review from project maintainers. Please correct me if I'm wrong.

Thanks for the suggestion, I'll try to find the original repository address.

@ds2643
Copy link

ds2643 commented Apr 4, 2024

@ferryman0608, I noticed that this repository is a mirror. I'm not sure you'll get adequate review from project maintainers. Please correct me if I'm wrong.

Thanks for the suggestion, I'll try to find the original repository address.

Yes, good luck. Again, I'm not a project maintainer, just some random programmer. The pull-request traffic on this repository is small relatively to the ubiquity of sqlite.

If you are reading this on GitHub or some other Git repository or service, then you are looking at a mirror.

This might be the canonical version control, but I can't find pull-request traffic.

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