title: How to set Architecture for docker build to arm64?
body: <p>I have a Dockerfile that I run on amd64 but want to run on arm64. Since go build tool takes GOARCH=arm64 as argument I don't need any other cross compilation tool to make the binary.</p>
  
  <pre><code># Run the build
  FROM mojlighetsministeriet/go-polymer-faster-build
  ENV WORKDIR /go/src/github.com/mojlighetsministeriet/email
  COPY . $WORKDIR
  WORKDIR $WORKDIR
  RUN go get -t -v ./...
  RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build
  
  # Create the final docker image
  FROM scratch
  COPY --from=0 /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
  COPY --from=0 /go/src/github.com/mojlighetsministeriet/email/email /
  ENTRYPOINT ["/email"]
  </code></pre>
  
  <p>The problem is that the resulting image gets marked with the wrong Architecture amd64 instead of arm64. How can I pass an argument to docker build so that it sets Architecture to arm64?</p>
  
  <pre><code>$ docker image inspect mojlighetsministeriet/email-arm64                            
  [
      {
          "Id": "sha256:33bcd7da8631c7a0829d61cc53479a26ab7f31fab1cb039105de415ddc6178f3",
          "RepoTags": [
              "mojlighetsministeriet/email-arm64:latest"
          ],
          "RepoDigests": [
              "mojlighetsministeriet/email-arm64@sha256:ab3f05d5597c3a304953b5c14f795179aa75bdfd458af3dc3cfb8b8d8eb87bc3"
          ],
          "Parent": "sha256:e5888262d93ea0946b5fd8146cf1c19ec3a7bac4d36eb51848ef0aefa75cf8e7",
          "Comment": "",
          "Created": "2017-12-05T18:36:36.273648787Z",
          "Container": "7a226edb3b52aaeeefec9e0fb4dd1da50d84992fb6cc374aeda9d82eec1bb2c8",
          "ContainerConfig": {
              "Hostname": "7a226edb3b52",
              "Domainname": "",
              "User": "",
              "AttachStdin": false,
              "AttachStdout": false,
              "AttachStderr": false,
              "Tty": false,
              "OpenStdin": false,
              "StdinOnce": false,
              "Env": [
                  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
              ],
              "Cmd": [
                  "/bin/sh",
                  "-c",
                  "#(nop) ",
                  "ENTRYPOINT [\"/email\"]"
              ],
              "Image": "sha256:e5888262d93ea0946b5fd8146cf1c19ec3a7bac4d36eb51848ef0aefa75cf8e7",
              "Volumes": null,
              "WorkingDir": "",
              "Entrypoint": [
                  "/email"
              ],
              "OnBuild": null,
              "Labels": {}
          },
          "DockerVersion": "17.10.0-ce",
          "Author": "",
          "Config": {
              "Hostname": "",
              "Domainname": "",
              "User": "",
              "AttachStdin": false,
              "AttachStdout": false,
              "AttachStderr": false,
              "Tty": false,
              "OpenStdin": false,
              "StdinOnce": false,
              "Env": [
                  "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
              ],
              "Cmd": null,
              "Image": "sha256:e5888262d93ea0946b5fd8146cf1c19ec3a7bac4d36eb51848ef0aefa75cf8e7",
              "Volumes": null,
              "WorkingDir": "",
              "Entrypoint": [
                  "/email"
              ],
              "OnBuild": null,
              "Labels": null
          },
          "Architecture": "amd64",
          "Os": "linux",
          "Size": 7861466,
          "VirtualSize": 7861466,
          "GraphDriver": {
              "Data": {
                  "LowerDir": "/var/lib/docker/overlay2/03cb0162bf922636e4e0ec90123b81565a447c6cd511741103551d2f0e7f09f9/diff",
                  "MergedDir": "/var/lib/docker/overlay2/091f74815a0caf457df7e57ade43b41c4dd8551388beca44815a7038501742ee/merged",
                  "UpperDir": "/var/lib/docker/overlay2/091f74815a0caf457df7e57ade43b41c4dd8551388beca44815a7038501742ee/diff",
                  "WorkDir": "/var/lib/docker/overlay2/091f74815a0caf457df7e57ade43b41c4dd8551388beca44815a7038501742ee/work"
              },
              "Name": "overlay2"
          },
          "RootFS": {
              "Type": "layers",
              "Layers": [
                  "sha256:66f615d03920919b0fa8bc9fed45515bb95636be1837fdd10a82b2c183e2ad5b",
                  "sha256:bd6a01b885eb6e3eec38a3fe3a2899646509633730b210cf6987456fd40b8a1c"
              ]
          },
          "Metadata": {
              "LastTagTime": "2017-12-14T10:24:10.796813522+01:00"
          }
      }
  ]
  </code></pre>