-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (22 loc) · 946 Bytes
/
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
# Use a compatible base image for Go
FROM golang:1.22-alpine AS builder
WORKDIR /source
COPY go.mod go.sum ./
RUN go mod download
COPY ./pkg ./pkg
# Cross-compile for Linux on x86 architecture
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o warp ./pkg
# Use a lightweight Alpine image
FROM alpine:3.14
COPY --from=builder /source/warp .
RUN mkdir /public
# Create a default config.yaml file
RUN echo "port: 8080" > /warp.yaml && \
echo "fallbackDocument: index.html" >> /warp.yaml && \
echo "root: index.html" >> /warp.yaml
# Create a default index.html file
RUN echo $'<body style="background-color: black; color: white;" ><h1>Hello !!</h1>\n\
<p>You have successfully setup and started Warp.</p>\n\
<p>Copy your own config file to <b>/warp.yaml</b> and your static files to the <b>/public</b> directory to serve your files.</p><body>' > /public/index.html
EXPOSE 8080
ENTRYPOINT [ "./warp" ]