Skip to content

Commit

Permalink
Restored accidental overwriting of file
Browse files Browse the repository at this point in the history
  • Loading branch information
johnfmorton committed Dec 23, 2021
1 parent cb130a8 commit 6c9b6a8
Showing 1 changed file with 9 additions and 43 deletions.
52 changes: 9 additions & 43 deletions OVERVIEW-for-DockerHub.md
Original file line number Diff line number Diff line change
@@ -1,59 +1,25 @@
# Docker Squoosh
This repo contains a Dockerfike for [Squoosh CLI](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli). You can find a repository of this image on GitHub at [johnfmorton/docker-squoosh-cli](https://github.com/johnfmorton/docker-squoosh-cli).
# johnfmorton/squoosh

## Description
This image contains an installation of [Squoosh CLI](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli).

This Dockerfile contains [Squoosh CLI](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) and defaults to using node 16. You can change the node version by altering the tag passed into the Dockerfile. (Note: Squoosh works on Node 12, 14, and 16 only.)

## Basic usage
## Basic use

From the command line, navigate to the directory containing the images you want to compress. Then run the following command.

```
docker run --rm -it -v `pwd`:/app johnfmorton/squoosh
```

The default command in the Dockerfile is `/bin/sh`, so you will be presented with a command prompt from within the container. You can now execute a squoosh-cli command. For example:

```
squoosh-cli --webp auto --optimizer-butteraugli-target 1.4 *.png
```

In the command above, you will take all of the .png files in the directory and make webp files of them using the 'auto' setting passing in a [butteraugli](https://github.com/google/butteraugli) distance of 1.4, which is the default distance.

Refer to the [documentation](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) for an exhaustive list of options.

If the options are overwhelming, try the [Squoosh GUI](https://squoosh.app/) to see what the options do to an image. Then you can copy those settings and use them via the command line.

## Alternative usage

Alternatively, you can pass in the `squoosh-cli` command along with

```
docker run --rm -it -v `pwd`:/app johnfmorton/squoosh squoosh-cli --webp auto --optimizer-butteraugli-target 1.4 *.png
```

## Using an alias

If you don't want to type that long docker command, use the method described in [Dock Life: Using Docker for All The Things!](https://nystudio107.com/blog/dock-life-using-docker-for-all-the-things).

I've got an alias in my zsh configuration file, i.e. the .zshrc file, that allows me to use `squoosh-cli` from my command line as if I had it installed on my local machine.

```
alias squoosh-cli='docker run --rm -it -v `pwd`:/app johnfmorton/squoosh squoosh-cli'
```

Then to use the command line version of Squoosh CLI, I do not need to have anything installed on my local machine besides Docker. I can run the following command on my command line and get the optimized images I expect.
You will be presented with another command prompt from within the container. You can now execute a squoosh-cli command. For example:

```
squoosh-cli --webp auto --optimizer-butteraugli-target 1.4 *.png
squoosh-cli --wp2 auto *.png
```

## Windows compatibility

I don't have a Windows machine to test on, but I think you'll need to substitute `pwd` (including the ticks, which Markdown is not displaying here) above with `"${CURDIR}"`.
Refer to the [documentation](https://github.com/GoogleChromeLabs/squoosh/tree/dev/cli) for an exhaustive list of options for Squoosh CLI.

## More information

## Future possible additions
See the GitHub repo for additional documentation on using this Dockerfile: https://github.com/johnfmorton/docker-squoosh-cli/

I have specific options I tend to reuse with Squoosh CLI. I may incorporate these into the image at some point. Currently, these options are executed through a text snippet I have on my machine.
Where to file issues: https://github.com/johnfmorton/docker-squoosh-cli/issues

0 comments on commit 6c9b6a8

Please sign in to comment.