Skip to content

Commit

Permalink
add dockerfile and ZSH command to run and push to dockerhub.io
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidChevallier committed Jul 11, 2024
1 parent 4379bf9 commit 22a7818
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
modules/**/*
config/**/*
.git/**/*
README.md
.gitignore
Dockerfile
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM golang:1.22.4-alpine3.20 AS builder
RUN apk add --no-cache bash git \
&& wget -q https://kcl-lang.io/script/install-cli.sh -O - | /bin/bash
WORKDIR /app
COPY . .
RUN go build -o crdtokcl main.go

FROM alpine:latest
RUN apk add --no-cache bash
WORKDIR /app
COPY --from=builder /app/crdtokcl /bin/crdtokcl
COPY --from=builder /usr/local/bin/kcl /usr/local/bin/kcl
ENTRYPOINT ["/bin/crdtokcl"]
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,19 @@ go run . -config config.json -debug
}
}
```

## Build Multiarch Docker Container

[docker.com](https://hub.docker.com/repository/docker/dchevallier/crdtokcl/)

```bash
docker buildx build --no-cache --platform linux/amd64,linux/arm64 -t dchevallier/crdtokcl:latest -t dchevallier/crdtokcl:v1.0.0 . --push
```

### Use crdtokcl Docker Container in ZSH

```bash
function crdtokcl() {
docker run --rm -v $(pwd):/app dchevallier/crdtokcl:latest "$@"
}
```

0 comments on commit 22a7818

Please sign in to comment.