Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ark0f/dockerfile.rs
Dockerfile builder in Rust
https://github.com/ark0f/dockerfile.rs
dockerfile dockerfile-generator rust
Last synced: 3 days ago
JSON representation
Dockerfile builder in Rust
- Host: GitHub
- URL: https://github.com/ark0f/dockerfile.rs
- Owner: ark0f
- License: apache-2.0
- Created: 2019-02-16T20:31:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-04-04T20:33:09.000Z (over 5 years ago)
- Last Synced: 2024-08-09T12:29:06.283Z (3 months ago)
- Topics: dockerfile, dockerfile-generator, rust
- Language: Rust
- Size: 73.2 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE.md
Awesome Lists containing this project
README
# dockerfile-rs
[![Build Status](https://travis-ci.org/ark0f/dockerfile.rs.svg?branch=master)](https://travis-ci.org/ark0f/dockerfile.rs)
![License](https://img.shields.io/crates/l/dockerfile_rs.svg)
[![crates.io](https://img.shields.io/crates/v/dockerfile-rs.svg)](https://crates.io/crates/dockerfile-rs)
[![API docs](https://docs.rs/dockerfile-rs/badge.svg)](https://docs.rs/dockerfile-rs)
[![Codecov](https://codecov.io/gh/ark0f/dockerfile.rs/branch/master/graph/badge.svg)](https://codecov.io/gh/ark0f/dockerfile.rs)Correct `Dockerfile` generator library
# Quick start
```rust
use std::{io::{Result, Write}, fs::File};
use dockerfile_rs::{DockerFile, FROM};fn main() -> Result<()> {
let docker_file = DockerFile::from(FROM!(nginx:latest))
.comment("open port for server")
.expose(80)
.copy((".", "."))
.cmd(vec!["echo", "Hello from container!"]);// write into file
let mut file = File::create("nginx.Dockerfile")?;
write!(&mut file, "{}", docker_file)?;
Ok(())
}
```Generated file:
```Dockerfile
FROM nginx:latest# open port for server
EXPOSE 80
COPY . .CMD ["echo", "Hello from container!"]
```# [Changelog](https://github.com/ark0f/dockerfile.rs/blob/master/CHANGELOG.md)
# License
dockerfile-rs under either of:* [Apache License 2.0](https://github.com/ark0f/dockerfile.rs/blob/master/LICENSE-APACHE.md)
* [MIT](https://github.com/ark0f/dockerfile.rs/blob/master/LICENSE-MIT.md)at your option.