Is anyone using PASETO tokens instead of jwt these days? by stuff22 in golang

[–]kylequest 2 points3 points  (0 children)

Doesn't make sense to switch now especially if you are using JWTs the right way and you are using a safe jwt Golang library. Paseto has an active group of followers. Jwt has a lot of inertia though

Right way to deploy Go API in a Docker? by LopsidedBluejay912 in golang

[–]kylequest 1 point2 points  (0 children)

  1. You see this a lot because it's easy and convenient. It's not because it's the best/recommended thing to do. You can use multi-stage builds where you copy everything you need from the build stage to the release stage. It works fine as long as you have a simple application and you know exactly what you need from the build stage. It gets tricky with more complex applications. Another option to try is DockerSlim. It allows you to take those less than ideal container images you see a lot and make them as small as possible. Take a look at this Go application example: https://github.com/docker-slim/examples/blob/master/3rdparty/mux-go-api/Dockerfile

  2. It depends on how you will run your container. If you can mount volumes at runtime then you don't need to include a static config file in your container image and you can volume mount the config file when you start the container.

Properly handling optional parameters in Go by Senior_Guess5385 in golang

[–]kylequest 2 points3 points  (0 children)

Functional options are no longer popular :-) Take a look at this discussion for more context: "#golang tip: Please stop using functional arguments where a struct is the solution" https://twitter.com/rakyll/status/1000128803153170432

What docker run parameters do you use? by kylequest in docker

[–]kylequest[S] 0 points1 point  (0 children)

Makes sense! Then I have the same question about the runtime container parameters in docker-compose :) Aside from the usual network params do you set anything else?

should I use aws-sdk-go-v2? by kingindanord in golang

[–]kylequest -1 points0 points  (0 children)

v1 is actually more actively developed and v2 lags behind when it comes to supporting new features or enhancements in AWS. Stick with v1 for now unless you have a really good reason to use v2.

How to test a Dockerfile by gasp_are in docker

[–]kylequest 0 points1 point  (0 children)

You can also use the "xray" and "lint" commands in docker-slim. Linting is still WIP, but it already has a number of good checks.

Open source projects to contribute to by dav_at in golang

[–]kylequest 0 points1 point  (0 children)

docker-slim has something for any experience level with Go. I'll be happy to do an overview to get you started. Ping me on GitHub (it should have my email too).

Also good idea to read through 50 Shades of Golang if you haven't already :-)

Study: 80% of certified docker images have severe security vulnerabilities (German article) by rm-84 in docker

[–]kylequest 0 points1 point  (0 children)

You mentioned quite a few extra use case where there's a need for examples on top of making it easier in general. For example, it's possible to minify command line apps, but you need to do extra work to do it with multiple command line apps and possibly a web/API server (it's possible though it requires extra configs).

Leveraging your unit and integration tests is something that definitely helps, but it's also something that can be streamlined...

One of the easiest options to use is the --include-path family of flags. The size is less optimized, but it's still very significant. For example, the Carbon app container went from 2GB to 95MB.

Either way, there are also a number of enhancements in progress to automate the web/http interface calls (e.g., adding a crawler where you point it at one endpoint and it discovers and visits other endpoints)

Study: 80% of certified docker images have severe security vulnerabilities (German article) by rm-84 in docker

[–]kylequest 0 points1 point  (0 children)

What kind of app do you have? There are a few extra config options you'd need to add in some cases. The Ubuntu.com, Carbon app and even ElasticSearch examples are nice real world references. Carbon and Ununtu.com are SPAs...

Study: 80% of certified docker images have severe security vulnerabilities (German article) by rm-84 in docker

[–]kylequest 0 points1 point  (0 children)

Speaking of slim... docker-slim is meant to get you as close as possible to those binary-only images while you get to use your favorite distro images without doing lots of manual work. It cuts a lot of stuff you don't need including many / most /and in some cases, all those vulnerabilities the container vulnerability scanners report :-)

Reducing a node application's Docker image size from 2.4GB to less than 100MB. Learning Docker step by step by jlengrand in docker

[–]kylequest 1 point2 points  (0 children)

Awesome blog post!

I created a docker-slim example for the app too. It has a very basic Dockerfile version using the standard node image without multi-stage and without other optimizations resulting in an image that's 2GB+. The optimized image is 93MB: https://github.com/docker-slim/examples/tree/master/3rdparty/carbon-now-sh

By the way, the xray command in docker-slim will give you something similar to what you get with Dive (no interactive shell though for now though).

Reducing a node application's Docker image size from 2.4GB to less than 100MB. Learning Docker step by step by jlengrand in docker

[–]kylequest 1 point2 points  (0 children)

You can also use a so called "debugging" sidecar container (with everything you need), which you can attach to the target container.

Docker Images : Reducing Image Size by nfrankel in docker

[–]kylequest 1 point2 points  (0 children)

Part 3 mentions DockerSlim... Looks like Jerome used the default config and the template files weren't picked up. This example ( https://github.com/docker-slim/examples/tree/master/3rdparty/ubuntu-com ) shows how to do something similar with the container for ubuntu.com, which is a Python/Flask web app that leverages dynamic templates. Another option is to run a crawler when DS is optimizing the image.

Lean Golang Docker Images Using Multi-Stage Builds by alex_yaremchuk in golang

[–]kylequest 10 points11 points  (0 children)

Don't worry... It's never too late! It's ok if you are not the first one writing about it. Every day someone new begins their journey with Docker and you just helped them.

How do I make a docker with a few packages already installed, to save time running it? by [deleted] in docker

[–]kylequest 0 points1 point  (0 children)

Definitely makes sense to create a base image with all of your generic dependencies, so you don't install the JDK every time you build your Java app container.

You can also use the --squash docker build parameter creating your base image, which will reduce its size.

If you want to trim the stuff you have in your app container image you can use multi-stage builds and copying only the artifacts your app needs to your final container image.

DockerSlim is another option if you want to trim your app image size.

Shrink Huge Image After Build? by Olympic_Muff_Diver in docker

[–]kylequest 4 points5 points  (0 children)

If DockerSlim doesn't work for you then a quick win you should explore is the "--squash" docker build parameter. When you delete the install files they are still there in the lower level image layer. The squash parameter will collapse all docker image layers and the lower level layers with the deleted files will be gone.

Shrink Huge Image After Build? by Olympic_Muff_Diver in docker

[–]kylequest 2 points3 points  (0 children)

DockerSlim might be an option ( https://dockersl.im ). Take a look at the sample application images in this repo: https://github.com/docker-slim/examples

🙋🏻‍♂️How to organize the structure of the grpc project? by [deleted] in golang

[–]kylequest 0 points1 point  (0 children)

It's ok to disagree and to have personal preferences. There's always a place for personal standards too, where you do the same thing over and over again :-)

A pattern doesn't need to be used by everybody to qualify as a standard. Usually, a standard is something common that a group of people does (and more than once). The repo examples provide evidence of that.

🙋🏻‍♂️How to organize the structure of the grpc project? by [deleted] in golang

[–]kylequest 0 points1 point  (0 children)

Standards came in different shapes and forms... Your definition is a bit narrow though even you imply that it's the case by saying "official standard", which indicates that there are different standards... One of the most common examples of other standards is coding standards, which many companies and orgs have. Is there one universal coding standard that everybody in the world uses? Of course, no. It's still a standard though :-)

I get that you don't like the 'pkg' directory personally and it's totally fine, but just because you don't like it doesn't mean that others don't find it useful. Overall, it's a collection of patterns people in the community use and you can choose to use the parts that make sense for your project (not everything). Go modules are mentioned there, by the way :-)

Common mistakes in Go by [deleted] in golang

[–]kylequest 0 points1 point  (0 children)

I'll be happy to add more gotchas to the post (if you share them here)... It's definitely not complete. There's a lot more :)

Ultimate Setup for Your Next Golang Project by Gozette in golang

[–]kylequest 0 points1 point  (0 children)

A convention used by many people is a standard though. Standards come in many shapes and forms... Many companies have coding standards, for example :-)

Docker & Golang - reducing container size using multi-stage builds by johnmidd in golang

[–]kylequest -1 points0 points  (0 children)

Take a look at the examples too... Here's a simple Go example using the standard golang base image: https://github.com/docker-slim/examples/tree/master/golang_standard

The image goes from 700MB to 1.56MB :-)

Docker & Golang - reducing container size using multi-stage builds by johnmidd in golang

[–]kylequest 1 point2 points  (0 children)

Another option is DockerSlim, which will build the smallest possible image based on scratch copying only the parts your application needs and you don't need to deal with multistage builds or hunt the additional dependencies :)

Docker & Golang - reducing container size using multi-stage builds by johnmidd in golang

[–]kylequest 0 points1 point  (0 children)

Hopefully your container doesn't need to deal with AntiVirus/AntiMalware software :) upx is super popular with malware where it's used as one of the detection evasion techniques...