Hey Nuno,

Thank you very much for your comprehensive explanation!

I have a question regarding the `remotes::install_local()` approach in the 
dockerfile, is that installing the master branch or the current branch that has 
been pushed to? I ask as I'm working on 'dev-am' branch and I got the following 
error:

Building image [***/scfdev:combiz/scFlow:0.7.1 ***/scfdev:dev-am 
***/scfdev:sha-658a6af]
invalid argument "***/scfdev:combiz/scFlow:0.7.1" for "-t, --tag" flag: invalid 
reference format
See 'docker build --help'.
Error: Error: exit status 125
Usage:
  github-actions build-push [flags]

Flags:
  -h, --help   help for build-push

exit status 125

Obviously, this may not be down to this but I'm just trying to rule things out 
since this was the only change I made to the dockerfile. The docker file has 
this added following your dockerfile:

## Install scFlow package
# Copy description
WORKDIR scFlow
ADD . .

# Install R package from source
RUN Rscript -e "remotes::install_local()"
RUN rm -rf *

Cheers,
Alan.
________________________________
From: Nuno Agostinho <nunodanielagosti...@gmail.com>
Sent: 03 June 2021 11:57
To: Murphy, Alan E <a.mur...@imperial.ac.uk>
Cc: bioc-devel@r-project.org <bioc-devel@r-project.org>
Subject: Re: [Bioc-devel] Add dockerhub push to github repository


This email from nunodanielagosti...@gmail.com originates from outside Imperial. 
Do not click on links and attachments unless you recognise the sender. If you 
trust the sender, add them to your safe senders 
list<https://spam.ic.ac.uk/SpamConsole/Senders.aspx> to disable email stamping 
for this address.



Hey Alan,

I would like to automatically create a new image and push to dockerhub with 
github actions when I push changes to the github repository. Does anyone have 
an example of this process in their repositories?

Well, I use GitHub actions to build a Docker image and push it to GitHub 
Container Registry, maybe this could help somehow: 
https://github.com/nuno-agostinho/psichomics/blob/master/.github/workflows/docker.yml

I use GitHub releases to release a new package version and, every time I 
release a new version, a new Docker image is built (this image also gets 
automatically tagged with the latest tag). I also build Docker images every 
time I push changes to the dev branch.

Regarding DockerHub, I have DockerHub set up to automatically build Docker 
images every time I push to master (to create the latest tag) and dev branches 
in GitHub, as well as every time I create a new tag (which I do when creating 
new releases). I could put this in the GitHub actions, but I didn't bother yet.

I would ideally like the tag of this dockerhub push to be the R package version 
(from the DESCRIPTION) to differentiate between images, is this possible?

I think you can run some bash script in your GitHub Actions based on your 
DESCRIPTION file. I would have to test but maybe something like:

    - name: Get R package version
      run: |
        version=$(grep Version DESCRIPTION | grep -o "[0-9.]\+")
        echo "packageVersion=${version}" >> $GITHUB_ENV
      shell:
        bash {0}

You can then access this variable in other steps via ${{ env.packageVersion }} 
like so:

    - name: Build and push
      uses: docker/build-push-action@v2
      with:
        push: true
        tags: ${{ github.repository }}:${{ env.packageVersion }}

Is there a way to tell the Dockerfile to install the R package in the current 
repository?

To build the image, I use ADD . . to put the GitHub repository content in the 
Docker image and then install the package using remotes::install_local(), as 
you can see from my Dockerfile: 
https://github.com/nuno-agostinho/psichomics/blob/master/Dockerfile

I hope I was clear and helpful. Please tell me if you need help with anything 
else! :)

Best,
Nuno Agostinho

On 3 Jun 2021, at 07:52, Murphy, Alan E 
<a.mur...@imperial.ac.uk<mailto:a.mur...@imperial.ac.uk>> wrote:

Hi all,

I'm working on developing an R package with the aim to eventually submit to 
Bioconductor. I would like to automatically create a new image and push to 
dockerhub with github actions when I push changes to the github repository. 
Does anyone have an example of this process in their repositories?

Two things to also consider, I would ideally like the tag of this dockerhub 
push to be the R package version (from the DESCRIPTION) to differentiate 
between images, is this possible? Secondly, I currently have the dockerfile 
created but, since my R package repository is private I have been building the 
R package and using the tar.gz file in the dockerfile to install the package 
(rather than using devtools::install_github()). Is there a way to tell the 
Dockerfile to install the R package in the current repository?

Kind regards,
Alan.

Alan Murphy
Bioinformatician
Neurogenomics lab
UK Dementia Research Institute
Imperial College London

[[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org<mailto:Bioc-devel@r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


        [[alternative HTML version deleted]]

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to