Dockerfile: A Dockerfile template

DockerfileR Documentation

A Dockerfile template

Description

A Dockerfile template

A Dockerfile template

Public fields

Dockerfile

The dockerfile content.

Methods

Public methods


Method new()

Create a new Dockerfile object.

Usage
Dockerfile$new(FROM = "rocker/r-base", AS = NULL)
Arguments
FROM

The base image.

AS

The name of the image.

Returns

A Dockerfile object.


Method RUN()

Add a RUN command.

Usage
Dockerfile$RUN(cmd)
Arguments
cmd

The command to add.

Returns

the Dockerfile object, invisibly.


Method ADD()

Add a ADD command.

Usage
Dockerfile$ADD(from, to, force = TRUE)
Arguments
from

The source file.

to

The destination file.

force

If TRUE, overwrite the destination file.

Returns

the Dockerfile object, invisibly.


Method COPY()

Add a COPY command.

Usage
Dockerfile$COPY(from, to, force = TRUE)
Arguments
from

The source file.

to

The destination file.

force

If TRUE, overwrite the destination file.

Returns

the Dockerfile object, invisibly.


Method WORKDIR()

Add a WORKDIR command.

Usage
Dockerfile$WORKDIR(where)
Arguments
where

The working directory.

Returns

the Dockerfile object, invisibly.


Method EXPOSE()

Add a EXPOSE command.

Usage
Dockerfile$EXPOSE(port)
Arguments
port

The port to expose.

Returns

the Dockerfile object, invisibly.


Method VOLUME()

Add a VOLUME command.

Usage
Dockerfile$VOLUME(volume)
Arguments
volume

The volume to add.

Returns

the Dockerfile object, invisibly.


Method CMD()

Add a CMD command.

Usage
Dockerfile$CMD(cmd)
Arguments
cmd

The command to add.

Returns

the Dockerfile object, invisibly.


Method LABEL()

Add a LABEL command.

Usage
Dockerfile$LABEL(key, value)
Arguments
key, value

The key and value of the label.

Returns

the Dockerfile object, invisibly.


Method ENV()

Add a ENV command.

Usage
Dockerfile$ENV(key, value)
Arguments
key, value

The key and value of the label.

Returns

the Dockerfile object, invisibly.


Method ENTRYPOINT()

Add a ENTRYPOINT command.

Usage
Dockerfile$ENTRYPOINT(cmd)
Arguments
cmd

The command to add.

Returns

the Dockerfile object, invisibly.


Method USER()

Add a USER command.

Usage
Dockerfile$USER(user)
Arguments
user

The user to add.

Returns

the Dockerfile object, invisibly.


Method ARG()

Add a ARG command.

Usage
Dockerfile$ARG(arg, ahead = FALSE)
Arguments
arg

The argument to add.

ahead

If TRUE, add the argument at the beginning of the Dockerfile.

Returns

the Dockerfile object, invisibly.


Method ONBUILD()

Add a ONBUILD command.

Usage
Dockerfile$ONBUILD(cmd)
Arguments
cmd

The command to add.

Returns

the Dockerfile object, invisibly.


Method STOPSIGNAL()

Add a STOPSIGNAL command.

Usage
Dockerfile$STOPSIGNAL(signal)
Arguments
signal

The signal to add.

Returns

the Dockerfile object, invisibly.


Method HEALTHCHECK()

Add a HEALTHCHECK command.

Usage
Dockerfile$HEALTHCHECK(check)
Arguments
check

The check to add.

Returns

the Dockerfile object, invisibly.


Method SHELL()

Add a SHELL command.

Usage
Dockerfile$SHELL(shell)
Arguments
shell

The shell to add.

Returns

the Dockerfile object, invisibly.


Method MAINTAINER()

Add a MAINTAINER command.

Usage
Dockerfile$MAINTAINER(name, email)
Arguments
name, email

The name and email of the maintainer.

Returns

the Dockerfile object, invisibly.


Method custom()

Add a custom command.

Usage
Dockerfile$custom(base, cmd)
Arguments
base, cmd

The base and command to add.

Returns

the Dockerfile object, invisibly.


Method print()

Print the Dockerfile.

Usage
Dockerfile$print()
Returns

used for side effect


Method write()

Write the Dockerfile to a file.

Usage
Dockerfile$write(as = "Dockerfile")
Arguments
as

The file to write to.

Returns

used for side effect


Method switch_cmd()

Switch commands.

Usage
Dockerfile$switch_cmd(a, b)
Arguments
a, b

The commands to switch.

Returns

the Dockerfile object, invisibly.


Method remove_cmd()

Remove a command.

Usage
Dockerfile$remove_cmd(where)
Arguments
where

The commands to remove.

Returns

the Dockerfile object, invisibly.


Method add_after()

Add a command after another.

Usage
Dockerfile$add_after(cmd, after)
Arguments
cmd

The command to add.

after

Where to add the cmd

Returns

the Dockerfile object, invisibly.


Method clone()

The objects of this class are cloneable with this method.

Usage
Dockerfile$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

my_dock <- Dockerfile$new()

dockerfiler documentation built on Sept. 11, 2024, 6:31 p.m.