Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/orisano/targd
targd is multistage build helper
https://github.com/orisano/targd
cli docker docker-build golang
Last synced: 7 days ago
JSON representation
targd is multistage build helper
- Host: GitHub
- URL: https://github.com/orisano/targd
- Owner: orisano
- License: mit
- Created: 2018-08-02T14:44:34.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-18T21:53:11.000Z (7 months ago)
- Last Synced: 2024-04-18T22:44:51.614Z (7 months ago)
- Topics: cli, docker, docker-build, golang
- Language: Go
- Homepage:
- Size: 1.12 MB
- Stars: 25
- Watchers: 6
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - orisano/targd - targd is multistage build helper (Go)
README
# targd
targd is multistage build helper. targd outputs dependent stage of the specified target stage. (includes target stage)## Installation
```bash
go get github.com/orisano/targd
```## How to use
```bash
$ targd
-f string
Dockerfile path (default "Dockerfile")
-o string
generated Dockerfile path (default "-")
-target string
target stage name (required)
```
```bash
$ targd -target test | docker build -f - .
```
or
```bash
$ docker run -v $(PWD):/host orisano/targd -f /host/Dockerfile -target production
```## Example
```dockerfile
# ./Dockerfile
FROM alpine:3.8 as builder
COPY ./depfile ./lockfile ./
RUN install_cmd
COPY . .
RUN build_cmdFROM builder as test
RUN test_cmdFROM alpine:3.8 as runtime
COPY --from=builder /bin/app /bin/app
ENTRYPOINT ["/bin/app"]
CMD ["--help"]
```
```bash
$ targd -target test
FROM alpine:3.8 as builder
COPY ./depfile ./lockfile ./
RUN install_cmd
COPY . .
RUN build_cmdFROM builder as test
RUN test_cmd```
```bash
$ targd -target runtime
FROM alpine:3.8 as builder
COPY ./depfile ./lockfile ./
RUN install_cmd
COPY . .
RUN build_cmdFROM alpine:3.8 as runtime
COPY --from=builder /bin/app /bin/app
ENTRYPOINT ["/bin/app"]
CMD ["--help"]```
## Author
Nao Yonashiro (@orisano)## License
MIT