Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# syntax=docker/dockerfile:1

## Build
FROM golang:1.16-buster AS build

WORKDIR /app

COPY go.mod ./
RUN go mod download

COPY *.go ./

RUN go build -o /http-file-server

## Deploy
FROM gcr.io/distroless/base-debian10

WORKDIR /

COPY --from=build /http-file-server /http-file-server

EXPOSE 8080

USER nonroot:nonroot

ENTRYPOINT ["/http-file-server", "/mount"]
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
VERSION = 1.6.1

APP := http-file-server
PACKAGES := $(shell go list -f {{.Dir}} ./...)
GOFILES := $(addsuffix /*.go,$(PACKAGES))
GOFILES := $(wildcard $(GOFILES))
APP := http-file-server
PACKAGES := $(shell go list -f {{.Dir}} ./...)
GOFILES := $(addsuffix /*.go,$(PACKAGES))
GOFILES := $(wildcard $(GOFILES))
DOCKER_REPONAME := gcr.io/sgreben/http-file-server
DOCKER_WHOLETAG := $(DOCKER_REPONAME):$(VERSION)

.PHONY: clean release README.md

Expand Down Expand Up @@ -67,3 +69,9 @@ release/$(APP)_$(VERSION)_linux_arm64.tar.gz: binaries/linux_arm64/$(APP)

binaries/linux_arm64/$(APP): $(GOFILES)
GOOS=linux GOARCH=arm64 go build -ldflags "-X main.version=$(VERSION)" -o binaries/linux_arm64/$(APP) .

docker: $(GOFILES)
docker build -t $(DOCKER_WHOLETAG) .

docker_buildkit_all: $(GOFILES)
docker buildx build --platform linux/amd64,linux/arm64 -t $(DOCKER_WHOLETAG) .
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.9"
services:
web:
build: .
ports:
- "8000:8080"
volumes:
- ./share:/mount