mirror of
https://github.com/simon987/Architeuthis.git
synced 2025-12-16 10:19:01 +00:00
dockerize app
This commit is contained in:
31
Dockerfile
Normal file
31
Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
||||
FROM golang:1.13-alpine as builder
|
||||
|
||||
ENV GO111MODULE=on
|
||||
|
||||
# Create the user and group files to run unprivileged
|
||||
RUN mkdir /user && \
|
||||
echo 'nobody:x:65534:65534:nobody:/:' > /user/passwd && \
|
||||
echo 'nobody:x:65534:' > /user/group
|
||||
|
||||
RUN apk update && apk add --no-cache git ca-certificates tzdata
|
||||
RUN mkdir /build
|
||||
COPY . /build/
|
||||
WORKDIR /build
|
||||
|
||||
COPY ./ ./
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags '-extldflags "-static"' -o architeuthis .
|
||||
|
||||
FROM scratch AS final
|
||||
LABEL author="simon987 <me@simon987.net>"
|
||||
|
||||
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
|
||||
COPY --from=builder /user/group /user/passwd /etc/
|
||||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
COPY --from=builder /build/architeuthis /
|
||||
COPY --from=builder /build/config.json /
|
||||
|
||||
WORKDIR /
|
||||
USER nobody:nobody
|
||||
ENTRYPOINT ["/architeuthis"]
|
||||
|
||||
EXPOSE 5050
|
||||
Reference in New Issue
Block a user