-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
59 lines (49 loc) · 1.83 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ARG GO_VERSION=1.22
#------------------------------------------------------------------------------
# Base Debian Image
#------------------------------------------------------------------------------
FROM debian:bookworm AS base
ARG GO_VERSION
ENV DEBIAN_FRONTEND='noninteractive' \
PATH="${PATH}:/usr/lib/go-${GO_VERSION}/bin:/go/bin" \
GOPATH='/go'
## Enable bookworm-backports
RUN echo "deb http://deb.debian.org/debian/ bookworm-backports main" > /etc/apt/sources.list.d/bookworm-backports.list
RUN echo "deb-src http://deb.debian.org/debian/ bookworm-backports main" >> /etc/apt/sources.list.d/bookworm-backports.list
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install --no-install-recommends \
clang \
gcc \
libltdl-dev \
git \
golang-${GO_VERSION} \
curl \
ca-certificates && \
# Cleanup inline with installation to avoid this layer being bloated with
# deb packages and other cached data.
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#------------------------------------------------------------------------------
# Build Stage
#------------------------------------------------------------------------------
FROM base AS builder
ENV GO111MODULE=on
ENV CGO_ENABLED=1
ADD . /app/src
RUN cd /app/src && go install .
#------------------------------------------------------------------------------
# Deployment Stage
#------------------------------------------------------------------------------
FROM base
EXPOSE 8080
# Copy compiled appliation from the builder.
RUN mkdir /app
ADD autograph-edge.yaml /app
ADD version.json /app
COPY --from=builder /go/bin/autograph-edge /usr/local/bin/autograph-edge
# Setup the worker and entrypoint.
RUN useradd --uid 10001 --home-dir /app --shell /sbin/nologin app
USER app
WORKDIR /app
CMD /usr/local/bin/autograph-edge