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

Task 3 - Feature: Add COMMENT #81

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jcrodriguez1989
Copy link

Resolves #3
Please let me know if further changes should be addressed 🚀

@jcrodriguez1989
Copy link
Author

Example:

library(dockerfiler)
# Create a dockerfile template
my_dock <- Dockerfile$new()
my_dock$MAINTAINER("Colin FAY", "contact@colinfay.me")
my_dock$COMMENT("Install required R package.")
my_dock$RUN(r(install.packages("attempt", repo = "http://cran.irsn.fr/")))
my_dock$COMMENT("Copy Plumber API and main script to container.")
my_dock$RUN("mkdir /usr/scripts")
my_dock$RUN("cd /usr/scripts")
my_dock$COPY("plumberfile.R", "/usr/scripts/plumber.R")
my_dock$COPY("torun.R", "/usr/scripts/torun.R")
my_dock$COMMENT("Expose the API port and run the main script when the container starts.")
my_dock$EXPOSE(8000)
my_dock$CMD("Rscript /usr/scripts/torun.R ")
my_dock
FROM rocker/r-base
MAINTAINER Colin FAY <contact@colinfay.me>
# Install required R package.
RUN R -e 'install.packages("attempt", repo = "http://cran.irsn.fr/")'
# Copy Plumber API and main script to container.
RUN mkdir /usr/scripts
RUN cd /usr/scripts
COPY plumberfile.R /usr/scripts/plumber.R
COPY torun.R /usr/scripts/torun.R
# Expose the API port and run the main script when the container starts.
EXPOSE 8000
CMD Rscript /usr/scripts/torun.R

@jcrodriguez1989
Copy link
Author

jcrodriguez1989 commented Oct 1, 2024

FYI, this happens with most my_dock$... commands.
Just one question, with this PR we are having the following unexpected behavior.

> library(dockerfiler)
> my_dock <- Dockerfile$new()
> my_dock$COMMENT("Comment 1 \nComment 2")
> my_dock
FROM rocker/r-base
# Comment 1 
Comment 2

How should we handle it?

  1. Doing nothing, the user should be aware of the comment input.
  2. Warning, but still returning the wrong Dockerfile.
  3. Remove the newlines, and put all of the comments in the same comment line (# Comment 1 Comment 2).
  4. Break the newlines into multiple comment lines.

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

Successfully merging this pull request may close these issues.

create a dock$COMMENT() to add a comment in the Dockerfile
1 participant