chore: reformat go
parent
ce2cd77bbe
commit
fab273aa7e
|
@ -139,23 +139,32 @@
|
||||||
<pre><span class="pl-k">RUN</span> CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOAMD64=v3 go build -o ./app -tags timetzdata -trimpath -ldflags=<span class="pl-s">"-s -w"</span> .</pre>
|
<pre><span class="pl-k">RUN</span> CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOAMD64=v3 go build -o ./app -tags timetzdata -trimpath -ldflags=<span class="pl-s">"-s -w"</span> .</pre>
|
||||||
</div>
|
</div>
|
||||||
<p>This is where I build Go program.</p>
|
<p>This is where I build Go program.</p>
|
||||||
<p>
|
<ul>
|
||||||
<code>CGO_ENABLED=0</code> because I don't want to mess with C libraries.
|
<li>
|
||||||
<code>GOOS=linux GOARCH=amd64</code> is easy to explain, Linux with
|
<code>CGO_ENABLED=0</code> because I don't want to mess with C
|
||||||
x86-64. <code>GOAMD64=v3</code> is new since
|
libraries.
|
||||||
<a href="https://go.dev/doc/go1.18#amd64" rel="nofollow">Go 1.18</a>, I
|
</li>
|
||||||
use v3 because I read about AMD64 version in
|
<li>
|
||||||
<a
|
<code>GOOS=linux GOARCH=amd64</code> is easy to explain, Linux with
|
||||||
href="https://gitlab.archlinux.org/archlinux/rfcs/-/blob/master/rfcs/0002-march.rst"
|
x86-64.
|
||||||
rel="nofollow"
|
</li>
|
||||||
>Arch Linux rfcs</a
|
<li>
|
||||||
>. TLDR's newer computers are already x86-64-v3.
|
<code>GOAMD64=v3</code> is new since
|
||||||
</p>
|
<a href="https://go.dev/doc/go1.18#amd64" rel="nofollow">Go 1.18</a>, I
|
||||||
<p>
|
use v3 because I read about AMD64 version in
|
||||||
<code>-tags timetzdata</code> to embed timezone database in case base
|
<a
|
||||||
image does not have. <code>-trimpath</code> to support reproduce build.
|
href="https://gitlab.archlinux.org/archlinux/rfcs/-/blob/master/rfcs/0002-march.rst"
|
||||||
<code>-ldflags="-s -w"</code> to strip debugging information.
|
rel="nofollow"
|
||||||
</p>
|
>Arch Linux rfcs</a
|
||||||
|
>. TLDR's newer computers are already x86-64-v3.
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<code>-tags timetzdata</code> to embed timezone database in case base
|
||||||
|
image does not have.
|
||||||
|
</li>
|
||||||
|
<li><code>-trimpath</code> to support reproduce build.</li>
|
||||||
|
<li><code>-ldflags="-s -w"</code> to strip debugging information.</li>
|
||||||
|
</ul>
|
||||||
<div class="highlight highlight-source-dockerfile">
|
<div class="highlight highlight-source-dockerfile">
|
||||||
<pre><span class="pl-k">FROM</span> gcr.io/distroless/base-debian11
|
<pre><span class="pl-k">FROM</span> gcr.io/distroless/base-debian11
|
||||||
|
|
||||||
|
|
|
@ -74,14 +74,13 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOAMD64=v3 go build -o ./app -tags tim
|
||||||
|
|
||||||
This is where I build Go program.
|
This is where I build Go program.
|
||||||
|
|
||||||
`CGO_ENABLED=0` because I don't want to mess with C libraries.
|
- `CGO_ENABLED=0` because I don't want to mess with C libraries.
|
||||||
`GOOS=linux GOARCH=amd64` is easy to explain, Linux with x86-64.
|
- `GOOS=linux GOARCH=amd64` is easy to explain, Linux with x86-64.
|
||||||
`GOAMD64=v3` is new since [Go 1.18](https://go.dev/doc/go1.18#amd64),
|
- `GOAMD64=v3` is new since [Go 1.18](https://go.dev/doc/go1.18#amd64),
|
||||||
I use v3 because I read about AMD64 version in [Arch Linux rfcs](https://gitlab.archlinux.org/archlinux/rfcs/-/blob/master/rfcs/0002-march.rst). TLDR's newer computers are already x86-64-v3.
|
I use v3 because I read about AMD64 version in [Arch Linux rfcs](https://gitlab.archlinux.org/archlinux/rfcs/-/blob/master/rfcs/0002-march.rst). TLDR's newer computers are already x86-64-v3.
|
||||||
|
- `-tags timetzdata` to embed timezone database in case base image does not have.
|
||||||
`-tags timetzdata` to embed timezone database in case base image does not have.
|
- `-trimpath` to support reproduce build.
|
||||||
`-trimpath` to support reproduce build.
|
- `-ldflags="-s -w"` to strip debugging information.
|
||||||
`-ldflags="-s -w"` to strip debugging information.
|
|
||||||
|
|
||||||
```Dockerfile
|
```Dockerfile
|
||||||
FROM gcr.io/distroless/base-debian11
|
FROM gcr.io/distroless/base-debian11
|
||||||
|
|
Loading…
Reference in New Issue