-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (29 loc) · 937 Bytes
/
Dockerfile
File metadata and controls
39 lines (29 loc) · 937 Bytes
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
# docker build -t imqs/router:latest --ssh default .
##################################
# builder image
##################################
FROM golang:1.22 AS builder
RUN mkdir /build
WORKDIR /build
# Authorize SSH Host
RUN mkdir -p /root/.ssh && \
chmod 0700 /root/.ssh && \
ssh-keyscan github.com > /root/.ssh/known_hosts
RUN --mount=type=ssh \
git config --global url."git@github.com:".insteadOf "https://github.com/"
# Cache downloads
COPY go.mod go.sum /build/
RUN --mount=type=ssh \
go mod download
# Compile
COPY . /build/
RUN go build -o router main.go
####################################
# deployed image
####################################
FROM imqs/ubuntu-base:24.04
COPY --from=builder /build/router /opt/router
EXPOSE 80
EXPOSE 443
HEALTHCHECK CMD curl --fail http://localhost/router/ping || exit 1
ENTRYPOINT ["wait-for-nc.sh", "config:80", "--", "/opt/router"]