-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
42 lines (31 loc) · 1.06 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# -*- coding: utf-8 -*-
# vim: ft=Dockerfile
# container - builder
FROM golang:1.19.1-alpine AS build
LABEL maintainer="mindhunter86 <mindhunter86@vkom.cc>"
ARG GOAPP_MAIN_VERSION="devel"
ARG GOAPP_MAIN_BUILDTIME="N/A"
ENV MAIN_VERSION=$GOAPP_MAIN_VERSION
ENV MAIN_BUILDTIME=$GOAPP_MAIN_BUILDTIME
# hadolint/hadolint - DL4006
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
WORKDIR /usr/sources/addie
COPY . .
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
# skipcq: DOK-DL3018 i'm a badboy, disable this shit
RUN echo "ready" \
&& go build -trimpath -ldflags="-s -w -X 'main.version=$MAIN_VERSION' -X 'main.buildtime=$MAIN_BUILDTIME'" -o addie \
&& apk add --no-cache upx \
&& upx -9 -k addie \
&& echo "nobody:x:65534:65534:nobody:/usr/local/bin:/bin/false" > etc_passwd
# container - runner
FROM scratch
LABEL maintainer="mindhunter86 <mindhunter86@vkom.cc>"
WORKDIR /usr/local/bin/
COPY --from=build /usr/sources/addie/etc_passwd /etc/passwd
COPY --from=build --chmod=0555 /usr/sources/addie/addie addie
USER nobody
ENTRYPOINT ["/usr/local/bin/addie"]
CMD ["--help"]