Adds docker container
This commit is contained in:
parent
21bc6f888f
commit
db21cc9d8d
4
.dockerignore
Normal file
4
.dockerignore
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
Dockerfile
|
||||||
|
tmp/
|
||||||
|
vendor/
|
||||||
|
data/
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
data/
|
||||||
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
ARG GO_VERSION=1.12
|
||||||
|
FROM golang:${GO_VERSION}-alpine AS builder
|
||||||
|
|
||||||
|
RUN apk add --no-cache ca-certificates git gcc libc-dev && \
|
||||||
|
mkdir -p /build/etc/ssl/certs && \
|
||||||
|
cp /etc/ssl/certs/ca-certificates.crt /build/etc/ssl/certs/ && \
|
||||||
|
echo 'app:x:2000:2000::/:' > /build/etc/passwd && \
|
||||||
|
echo 'app:x:2000:' > /build/etc/group
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
COPY . .
|
||||||
|
RUN go mod download
|
||||||
|
RUN go build -o /build/app cmd/server/server.go
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
# alpine required because the built app depends on some dynamicly linked lib,
|
||||||
|
# thanks to not being able to build without CGO which the sqlite3 pkg depends on
|
||||||
|
FROM alpine:3.9 AS final
|
||||||
|
#FROM scratch AS final
|
||||||
|
|
||||||
|
COPY --from=builder --chown=2000:2000 /build /
|
||||||
|
|
||||||
|
USER 2000:2000
|
||||||
|
ENV HOME /data
|
||||||
|
WORKDIR $HOME
|
||||||
|
VOLUME $HOME
|
||||||
|
EXPOSE 8082
|
||||||
|
|
||||||
|
CMD ["/app", "-addr=:8082", "-path=/data/servers.db"]
|
||||||
Loading…
x
Reference in New Issue
Block a user