Skip to content

Commit

Permalink
Merge pull request #26 from mozilla-services/dockerize-ciplatforms-cl…
Browse files Browse the repository at this point in the history
…i-app

Dockerize ciplatforms CLI app 🐳
  • Loading branch information
hackebrot authored Nov 18, 2024
2 parents 8478aa0 + 5074717 commit c181837
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ciplatforms/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Exclude everything by default
*

# Except for Go source files and Go dependency files
!**/*.go
!go.mod
!go.sum
17 changes: 17 additions & 0 deletions ciplatforms/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM golang:1.23 AS builder

WORKDIR /app

COPY go.mod go.sum ./

RUN go mod download

COPY . .

RUN CGO_ENABLED=0 GOOS=linux go build -o /app/ciplatforms

FROM gcr.io/distroless/static-debian12:nonroot

COPY --from=builder /app/ciplatforms /app/ciplatforms

ENTRYPOINT [ "/app/ciplatforms" ]
26 changes: 26 additions & 0 deletions ciplatforms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,29 @@ repository, including its accessibility (a repository may be inaccessible if it
does not exist or if the provided authentication token lacks access), and flags
indicating the presence of CircleCI, GitHub Actions, and Taskcluster
configuration files.

## Docker

You can also run the `ciplatforms` app as a Docker container.

### Build the Docker Image

To build the Docker image, use the following command:

```bash
docker build -t ciplatforms:latest .
```

### Run the Docker Container

To run the `info` subcommand inside the Docker container, mount the directory
containing the input and output files as a volume and pass the required
environment variable:

```bash
docker run --rm \
-e CIPLATFORMS_GITHUB_API_TOKEN \
-v $(pwd)/data:/data \
ciplatforms:latest \
info --input /data/services.csv --output /data/services_out.json
```

0 comments on commit c181837

Please sign in to comment.