-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# syntax=docker/dockerfile:1.4.2 | ||
|
||
FROM ubuntu:20.04 | ||
|
||
## Install requirements | ||
|
||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC \ | ||
apt-get install -y \ | ||
nodejs \ | ||
npm | ||
|
||
## Install ro-crate-html-js | ||
RUN npm install ro-crate-html-js | ||
ENV PATH "/node_modules/.bin:$PATH" | ||
|
||
## Create directory for output | ||
RUN mkdir /tmp/output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
sudo docker build -t rocrate-preview . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Create and run a Docker container | ||
|
||
## Create a Dockerfile | ||
|
||
Create a `Dockerfile` which starts with a base docker image e.g. Ubuntu. | ||
|
||
In this file, you install the software you need, set environment variables, create directories etc. | ||
|
||
[Example](Dockerfile). | ||
|
||
## Build the container | ||
|
||
Use the command `docker build -t` to create a container and tag it with a name. | ||
|
||
Docker is looking for a file called `Dockerfile` in the specified directory. | ||
|
||
[Example](build.sh) | ||
|
||
## Run the container | ||
|
||
Use `docker run` to run the container. | ||
|
||
`-w` sets the working directory in the container's file system. | ||
|
||
`-v` mounts a volume (directory or file), which is like a mapped network drive. The docker container has read/write access to this directory on the host machine. | ||
|
||
The `docker run` command includes the commands you want to run in the container. | ||
|
||
[ Example](run.sh) | ||
|
||
You can also run a container [interactively](interactive.sh). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# sudo docker run -it rocrate-preview:latest | ||
sudo docker run -v /home/mbexegc2/projects/esciencelab/rocrate-to-pages/ro-crate-metadata.json:/tmp/ro-crate-metadata.json \ | ||
-w /tmp \ | ||
-it \ | ||
rocrate-preview:latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
sudo docker run -v /home/mbexegc2/projects/esciencelab/rocrate-to-pages/ro-crate-metadata.json:/tmp/ro-crate-metadata.json \ | ||
-w /tmp \ | ||
-v /home/mbexegc2/projects/esciencelab/docker/output:/tmp/output \ | ||
rocrate-preview:latest \ | ||
bash -c $'rochtml ro-crate-metadata.json; mv ro-crate-preview.html /tmp/output' |