# Going tiny - A 7.7MB server image

**URL:** <https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33>\
**Category:** General\
**Created:** [July 28, 2020, 5:00pm UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33 "2020-07-28T17:00:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Codepope](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/codepope/32/4_2.png) [@Codepope](https://community.fly.io/u/Codepope)\
**Post date:** [July 28, 2020, 5:00pm UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33/1 "2020-07-28T17:00:49Z")

</div>

The best things in life are small, at least when it comes to web serving. In [Serve small with Fly.io and GoStatic](https://fly.io/blog/serve-small-with-fly-io-and-gostatic/) we squeeze things down to 7.7MB for a web server, content and Fly takes care of all the https work for us.

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [July 28, 2020, 5:34pm UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33/2 "2020-07-28T17:34:22Z")

</div>

This might be the smallest image so far.

---

<div class="post-metadata">

**Author:** ![peterpme](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/peterpme/32/260_2.png) [@peterpme](https://community.fly.io/u/peterpme)\
**Post date:** [July 30, 2020, 2:16am UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33/3 "2020-07-30T02:16:24Z")

</div>

Definitely, compared to our node 80mb files lol

---

<div class="post-metadata">

**Author:** ![srinath](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/srinath/32/1738_2.png) [@srinath](https://community.fly.io/u/srinath)\
**Post date:** [July 31, 2020, 11:30am UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33/4 "2020-07-31T11:30:01Z")

</div>

And I thought my 17.6mb image wasn’t too shabby. To be fair, the binary itself weight in around 15mb and does require other things like ca-certs. The `gcr.io/distroless/static` image works great for my needs!

---

<div class="post-metadata">

**Author:** ![blake](https://avatars.discourse-cdn.com/v4/letter/b/a9a28c/32.png) [@blake](https://community.fly.io/u/blake)\
**Post date:** [November 1, 2020, 8:57am UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33/5 "2020-11-01T08:57:44Z")

</div>

For my rust friends, I can highly recommend [https://github.com/emk/rust-musl-builder](https://github.com/emk/rust-musl-builder)

---

<div class="post-metadata">

**Author:** ![hb9cwp](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/hb9cwp/32/15573_2.png) [@hb9cwp](https://community.fly.io/u/hb9cwp)\
**Post date:** [May 12, 2022, 11:48am UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33/6 "2022-05-12T11:48:59Z")

</div>

What is the best/correct way to pass [command line arguments to goStatic](https://hub.docker.com/r/pierrezemb/gostatic), such as `-enable-logging -enable-health`?  
What I have tried to add in my `Dockerfile`, but without success so far, also the :

> **CMD ./goStatic -enable-logging -enable-health**  
> CMD ./goStatic --enable-logging --enable-health  
> CMD goStatic --enable-logging --enable-health  
> CMD [“goStatic”, “-enable-logging”. “-enable-health”]  
> CMD [“-enable-logging”. “-enable-health”]

This is what the logs on [fly.io](http://fly.io) /apps/goStaticNN/logs show for the **first CMD line** above:

> 2022-05-12T11:42:17.347 runner[018b147] fra [info] Configuring firecracker  
> 2022-05-12T11:42:17.450 runner[018b147] fra [info] Starting virtual machine  
> 2022-05-12T11:42:17.718 app[018b147] fra [info] Starting init (commit: 252b7bd)…  
> 2022-05-12T11:42:17.735 app[018b147] fra [info] Preparing to run: **`/goStatic /bin/sh -c ./goStatic -enable-logging -enable-health`** as appuser  
> 2022-05-12T11:42:17.739 app[018b147] fra [info] 2022/05/12 11:42:17 listening on [fdaa:0:5f91:a7b:67:18b:1479:2]:22 (DNS: [fdaa::3]:53)  
> 2022-05-12T11:42:17.777 app[018b147] fra [info] 11:42AM INF Listening at [http://0.0.0.0:8043](http://0.0.0.0:8043) /…

Likely, it is obvious. Thanks for any hints.

---

<div class="post-metadata">

**Author:** ![jerome](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jerome/32/17_2.png) [@jerome](https://community.fly.io/u/jerome)\
**Post date:** [May 12, 2022, 11:59am UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33/7 "2022-05-12T11:59:34Z")

</div>

What’s wrong with the app? It seems to be working correctly from looking at the logs.

In general, tou want to set the CMD as an array and (possibly) use an entrypoint, like:

```auto
ENTRYPOINT ["./goStatic"]
CMD ["-enable-logging", "-enable-health"]

```

What are you expecting to happen that’s not happening?

---

<div class="post-metadata">

**Author:** ![hb9cwp](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/hb9cwp/32/15573_2.png) [@hb9cwp](https://community.fly.io/u/hb9cwp)\
**Post date:** [May 12, 2022, 1:16pm UTC](https://community.fly.io/t/going-tiny-a-7-7mb-server-image/33/8 "2022-05-12T13:16:12Z")

</div>

Great, I missed out on setting the `ENTRYPOINT` as well. This eliminated the redundant **`/goStatic /bin/sh -c ./goStatic ...`** above. Thank you, I could not figure out how to get rid of that.

Note however, it turns out that there must not be a leading “.” in the path to this Go binary (`./goStatic` leads to `UnhandledIoError` and `CPU panic`).

But with this in my Dockerfile, goStatic starts with the options:

> ENTRYPOINT [“/goStatic”]  
> CMD [“-enable-logging”, “-enable-health”]

It writes additional logs to [Fly.io](http://Fly.io), and also answers requests to the `/health` endpoint with 200 OK 🙂

> 2022-05-12T12:44:45.524 runner[afb0d0eb] fra [info] Starting virtual machine  
> 2022-05-12T12:44:45.801 app[afb0d0eb] fra [info] Starting init (commit: 252b7bd)…  
> 2022-05-12T12:44:45.822 app[afb0d0eb] fra [info] Preparing to run: **`/goStatic -enable-logging -enable-health`** as appuser  
> 2022-05-12T12:44:45.829 app[afb0d0eb] fra [info] 2022/05/12 12:44:45 listening on [fdaa:0:5f91:a7b:67:afb0:d0eb:2]:22 (DNS: [fdaa::3]:53)  
> 2022-05-12T12:44:45.871 app[afb0d0eb] fra [info] 12:44PM WRN enable-logging is deprecated in favor of log-level  
> 2022-05-12T12:44:45.871 app[afb0d0eb] fra [info] 12:44PM WRN since enable-logging is set, setting log-level to debug  
> 2022-05-12T12:44:45.871 app[afb0d0eb] fra [info] 12:44PM **DBG Logger setup… Logging Level=debug**  
> 2022-05-12T12:44:45.871 app[afb0d0eb] fra [info] 12:44PM DBG File serve path set path=/srv/http  
> 2022-05-12T12:44:45.871 app[afb0d0eb] fra [info] 12:44PM INF Listening at [http://0.0.0.0:8043](http://0.0.0.0:8043) /…  
> 2022-05-12T12:45:17.571 runner[3d1182f9] fra [info] Shutting down virtual machine  
> 2022-05-12T12:45:17.691 app[3d1182f9] fra [info] Sending signal SIGINT to main child process w/ PID 515  
> 2022-05-12T12:45:17.694 app[3d1182f9] fra [info] Main child exited with signal (with signal ‘SIGINT’, core dumped? false)  
> 2022-05-12T12:45:17.695 app[3d1182f9] fra [info] Starting clean up.  
> 2022-05-12T12:45:18.061 app[afb0d0eb] fra [info] 12:45PM **DBG Request Handled Method=GET Path=/**  
> 2022-05-12T12:45:32.010 app[afb0d0eb] fra [info] 12:45PM **DBG Returning Service Health**  
> 2022-05-12T12:45:32.075 app[afb0d0eb] fra [info] 12:45PM DBG Request Handled Method=GET Path=/favicon.ico
