File: Dockerfile

package info (click to toggle)
icingadb 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 45,716 kB
  • sloc: ansic: 169,210; asm: 7,097; sql: 4,098; sh: 1,415; cpp: 1,132; makefile: 418; xml: 160
file content (47 lines) | stat: -rw-r--r-- 1,520 bytes parent folder | download | duplicates (5)
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
# =============================================================================
#  Multi-stage Dockerfile Example
# =============================================================================
#  This is a simple Dockerfile that will build an image of scratch-base image.
#  Usage:
#    docker build -t simple:local . && docker run --rm simple:local
# =============================================================================

# -----------------------------------------------------------------------------
#  Build Stage
# -----------------------------------------------------------------------------
FROM golang:alpine3.18 AS build

# Important:
#   Because this is a CGO enabled package, you are required to set it as 1.
ENV CGO_ENABLED=1

RUN apk add --no-cache \
    # Important: required for go-sqlite3
    gcc \
    # Required for Alpine
    musl-dev

WORKDIR /workspace

COPY . /workspace/

RUN \
    cd _example/simple && \
    go mod init github.com/mattn/sample && \
    go mod edit -replace=github.com/mattn/go-sqlite3=../.. && \
    go mod tidy && \
    go install -ldflags='-s -w -extldflags "-static"' ./simple.go

RUN \
    # Smoke test
    set -o pipefail; \
    /go/bin/simple | grep 99\ こんにちは世界099

# -----------------------------------------------------------------------------
#  Main Stage
# -----------------------------------------------------------------------------
FROM scratch

COPY --from=build /go/bin/simple /usr/local/bin/simple

ENTRYPOINT [ "/usr/local/bin/simple" ]