File: Dockerfile

package info (click to toggle)
golang-github-coredhcp-coredhcp 0.0.0%2Bgit.20250806.f7e98e4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 460 kB
  • sloc: makefile: 8; sh: 6
file content (43 lines) | stat: -rw-r--r-- 996 bytes parent folder | download
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
FROM ubuntu:22.04

LABEL BUILD="docker build -t coredhcp/coredhcp -f Dockerfile ."
LABEL RUN="docker run --rm -it coredhcp/coredhcp"

# Install dependencies
RUN apt-get update &&                          \
    apt-get install -y --no-install-recommends \
        sudo \
	iproute2 \
        # to fetch the Go toolchain
        ca-certificates \
        wget \
        # for go get
        git \
	# for CGo support
	build-essential \
        && \
    rm -rf /var/lib/apt/lists/*

# install Go
WORKDIR /tmp
RUN set -exu; \
    wget https://golang.org/dl/go1.23.4.linux-amd64.tar.gz ;\
    tar -C / -xvzf go1.23.4.linux-amd64.tar.gz
ENV PATH="$PATH:/go/bin:/build/bin"
ENV GOPATH=/go:/build

ENV PROJDIR=/build/src/github.com/coredhcp/coredhcp
RUN mkdir -p $PROJDIR
COPY . $PROJDIR

# build coredhcp
RUN set -exu ;\
    cd $PROJDIR/cmds/coredhcp ;\
    go get -v ./... ;\
    CGO_ENABLED=1 go build ;\
    cp coredhcp /bin

EXPOSE 67/udp
EXPOSE 547/udp

CMD coredhcp --conf /etc/coredhcp/config.yaml