fix #16: Base image centurylink/ca-certs is outdated (3 years old)

As we dropped HTTPS support, we can remove ca-certs and ldflags I guess
This commit is contained in:
Pierre Zemb 2018-09-02 19:39:18 +00:00
parent 555e0d9ace
commit 6f5dcaead9
No known key found for this signature in database
GPG key ID: 9EE30A8B43F150C4
2 changed files with 4 additions and 17 deletions

View file

@ -2,11 +2,10 @@
FROM golang:latest as builder FROM golang:latest as builder
WORKDIR /go/src/github.com/PierreZ/goStatic WORKDIR /go/src/github.com/PierreZ/goStatic
COPY . . COPY . .
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -tags netgo -installsuffix netgo
RUN GOARCH=amd64 GOOS=linux go build -tags netgo -installsuffix netgo -ldflags "-linkmode external -extldflags -static -w"
# stage 1 # stage 1
FROM centurylink/ca-certs FROM scratch
WORKDIR / WORKDIR /
COPY --from=builder /go/src/github.com/PierreZ/goStatic/goStatic . COPY --from=builder /go/src/github.com/PierreZ/goStatic/goStatic .
ENTRYPOINT ["/goStatic"] ENTRYPOINT ["/goStatic"]

View file

@ -1,8 +1,6 @@
# goStatic [![Docker Pulls](https://img.shields.io/docker/pulls/pierrezemb/gostatic.svg?style=plastic)](https://hub.docker.com/r/pierrezemb/gostatic/) [![Docker Build](https://img.shields.io/docker/build/pierrezemb/gostatic.svg?style=plastic)](https://hub.docker.com/r/pierrezemb/gostatic/) [![Build Status](https://travis-ci.org/PierreZ/goStatic.svg?branch=master)](https://travis-ci.org/PierreZ/goStatic) [![GoDoc](https://godoc.org/github.com/PierreZ/goStatic?status.svg)](https://godoc.org/github.com/PierreZ/goStatic) # goStatic [![Docker Pulls](https://img.shields.io/docker/pulls/pierrezemb/gostatic.svg?style=plastic)](https://hub.docker.com/r/pierrezemb/gostatic/) [![Docker Build](https://img.shields.io/docker/build/pierrezemb/gostatic.svg?style=plastic)](https://hub.docker.com/r/pierrezemb/gostatic/) [![Build Status](https://travis-ci.org/PierreZ/goStatic.svg?branch=master)](https://travis-ci.org/PierreZ/goStatic) [![GoDoc](https://godoc.org/github.com/PierreZ/goStatic?status.svg)](https://godoc.org/github.com/PierreZ/goStatic)
A really small static web server for Docker A really small static web server for Docker
### The goal ### The goal
My goal is to create to smallest docker container for my web static files. The advantage of Go is that you can generate a fully static binary, so that you don't need anything else. My goal is to create to smallest docker container for my web static files. The advantage of Go is that you can generate a fully static binary, so that you don't need anything else.
@ -60,14 +58,4 @@ Usage of /goStatic:
The listening port (default 8043) The listening port (default 8043)
-set-basic-auth string -set-basic-auth string
Define the basic auth. Form must be user:password Define the basic auth. Form must be user:password
``` ```
### Wow, such container! What are you using?
I'm using the centurylink/ca-certs image instead of the scratch image to avoid this error:
```
x509: failed to load system roots and no roots provided
```
The centurylink/ca-certs image is simply the scratch image with the most common root CA certificates pre-installed. The resulting image is only 258 kB which is still a good starting point for creating your own minimal images.