github.com/knoebber/dotfile@v1.0.6/Dockerfile (about)

     1  # fly.io uses Ubuntu/Debian instead of Alpine to avoid DNS resolution issues in production.
     2  
     3  ARG BUILDER_IMAGE="golang:1.18.10-buster"
     4  ARG RUNNER_IMAGE="debian:bullseye-20220801-slim"
     5  
     6  FROM ${BUILDER_IMAGE} as builder
     7  
     8  # prepare build dir
     9  WORKDIR /app
    10  COPY go.mod go.sum ./
    11  RUN go mod download && go mod verify
    12  COPY . .
    13  RUN make dotfilehub
    14  
    15  # start a new build stage so that the final image will only contain the compiled binary
    16  FROM ${RUNNER_IMAGE}
    17  
    18  RUN apt-get update -y && apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates \
    19    && apt-get clean && rm -f /var/lib/apt/lists/*_*
    20  
    21  # Set the locale
    22  RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
    23  
    24  ENV LANG en_US.UTF-8
    25  ENV LANGUAGE en_US:en
    26  ENV LC_ALL en_US.UTF-8
    27  
    28  WORKDIR "/app/bin"
    29  RUN chown nobody /app
    30  
    31  COPY --from=builder --chown=nobody:root /app/bin/dotfilehub .
    32  
    33  USER nobody
    34  
    35  CMD [\
    36      "/app/bin/dotfilehub",\
    37      "-addr=:8080",\
    38      "-db=/data/dotfilehub.db",\
    39      "-smtp-config-path=/data/smtp.json",\
    40      "-host=dotfilehub.com",\
    41      "-secure",\
    42      "-proxyheaders"\
    43  ]