Raku / examples

Many examples of Raku code
https://examples.raku.org/
Artistic License 2.0
294 stars 89 forks source link

test Dockerfile #62

Closed brm-ryd closed 4 years ago

brm-ryd commented 5 years ago

Hi,

Just upload Dockerfile for test building perl6-examples environment. Please to correct me if i'm wrong, there are still a lot need to improve in this Dockerfile i believe.

Many thanks

maettu commented 5 years ago

Thanks für the dockerfile. This is the way we want to go for (most of the) infra stuff. I'll most probably favor running ubuntu, but that looks like a very minor change. Also I think we will want to use / produce an image with Perl 6 installed and use that as a basis.

Tyil commented 5 years ago

@maettu is there a reason to prefer Ubuntu? Alpine has a much smaller base, so if the intent is just to run an application, Alpine is a much saner choice.

If you want a Docker container that comes with Perl 6, there's multiple options:

There's probably more options available, and they're not hard to set up if you want something custom-made for this project. @JJ, thoughts (since you seem to be doing the most with Docker in the community)?

brm-ryd commented 5 years ago

Hi All,

Sorry, i'd like to ask for confirmation & advice, to merge the pull request, i'll need to wait for verification of other members isnt ?

Many thanks & sorry,

Tyil commented 5 years ago

@brm-ryd No need to be sorry! Your work is much appreciated!

If you've been given permissions to merge your own PRs, you are allowed to do so. However, many members still prefer to get some input from other members before doing so, to ensure everything goes well and to get the best solution in the repository.

That said, I have no objections to this PR as it is. I will clone your branch, build the Docker image with this particular Dockerfile and try to run the resulting container. If all goes well, I will merge it for you.

P.S.: There's Rakudo packages available for Alpine. This could greatly reduce the amount of time required to build the image.

JJ commented 5 years ago

I'll try to check it out

El lun., 22 jul. 2019 16:54, brm notifications@github.com escribió:

Hi All,

Sorry, i'd like to ask for confirmation & advice, to merge the pull request, i'll need to wait for verification of other members isnt ?

Many thanks & sorry,

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/perl6/perl6-examples/pull/62?email_source=notifications&email_token=AAAAD5GXICR56EBBO6PIGHLQAXC25A5CNFSM4IDYJCO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2QF7CI#issuecomment-513826697, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAD5BZXCGRFEIFOFEMXVLQAXC25ANCNFSM4IDYJCOQ .

brm-ryd commented 5 years ago

@Tyil & @JJ many thanks for the feedback & yes will check for the rakudo-pkg as before i uploaded above i only tried using the rakudo-star dockerfile & AFAIK need to reduce the RUN step in the Dockerfile to reduce the layer process of container.

Again many thanks & please feel free to correct me if i'm wrong.

Tyil commented 5 years ago

AFAIK need to reduce the RUN step in the Dockerfile

You can do this, or look at multi-stage builds in Docker. These will keep the Dockerfile cleaner, and can still get you the result you want. I have a blogpost where this feature is used for Perl 6 specifically: https://tyil.nl/post/2019/04/11/perl6-nightly-docker-images/. This may help give a picture on using them in this Dockerfile, if you want.

brm-ryd commented 5 years ago

@Tyil many thanks - will also look for that as well.

brm-ryd commented 5 years ago

Hi, Below is Dockerfile with combine for multi build & using rakudo-pkg, i'm not upload it into the repo yet as i'm still not quite sure if its working / not.

FROM perl:5.20
RUN curl -L https://cpanmin.us | perl - -M https://cpan.metacpan.org -n Mojolicious

FROM alpine:3.10

RUN apk add --update --no-cache build-base wget git curl \
    && wget https://github.com/nxadm/rakudo-pkg/releases/download/v2019.07/rakudo-pkg-Alpine3.10_2019.07-01_x86_64.apk && \
    apk add --allow-untrusted rakudo-pkg-Alpine3.10_2019.07-01_x86_64.apk 
ENV PATH=$PATH:/opt/rakudo-pkg/bin

RUN mkdir -p /opt/perl6-examples \ && git clone https://github.com/perl6/perl6-examples /opt/perl6-examples \
    && cd /opt/perl6-examples && zef --/test --test-depends --depsonly install . && make html

EXPOSE 3000
ENTRYPOINT perl /opt/perl6-examples/app.pl daemon

Above Dockerfile build successfully within short time manner IMHO with below list images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
<none>              <none>              704f5a5ae936        32 minutes ago      261MB
<none>              <none>              9cf75b956340        41 minutes ago      689MB
alpine              3.10                b7b28af77ffe        2 weeks ago         5.58MB
perl                5.20                bbe5a82c1dbe        3 years ago         655MB

With above images i'm still find out to make sure if the Dockerfile running well with the perl6-examples installed / not though. I'd really happy to hear anykind of comments from you & this link is something i'd like to try also for the test purpose: .

Many thanks for your help

brm-ryd commented 5 years ago

Hi, Sorry again, just commit some changes & from my box its already running - the building process time shorter than before though. Please correct me if im wrong & any input will be appreciated.

Many thanks