Upload Dockerfile
Browse files- Dockerfile +49 -0
Dockerfile
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Start from the official Golang image
|
2 |
+
FROM docker.io/library/golang:alpine AS build
|
3 |
+
|
4 |
+
# Set the Current Working Directory inside the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy go mod and sum files
|
8 |
+
COPY go.mod go.sum ./
|
9 |
+
|
10 |
+
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
|
11 |
+
RUN go mod download
|
12 |
+
|
13 |
+
# Copy the source code from the current directory to the Working Directory inside the container
|
14 |
+
COPY . .
|
15 |
+
|
16 |
+
# test and build the app.
|
17 |
+
RUN go test -timeout=30s ./... && go build -ldflags='-s -w' -o m3u-proxy .
|
18 |
+
|
19 |
+
# End from the latest alpine image
|
20 |
+
# hadolint ignore=DL3007
|
21 |
+
FROM docker.io/library/alpine:latest
|
22 |
+
|
23 |
+
# add bash and timezone data
|
24 |
+
# hadolint ignore=DL3018
|
25 |
+
RUN apk --no-cache add tzdata \
|
26 |
+
ca-certificates \
|
27 |
+
su-exec \
|
28 |
+
&& update-ca-certificates
|
29 |
+
|
30 |
+
# set the current workdir
|
31 |
+
WORKDIR /m3u-proxy
|
32 |
+
|
33 |
+
# copy in our compiled GO app
|
34 |
+
COPY --from=build /app/m3u-proxy /m3u-proxy/
|
35 |
+
|
36 |
+
# Copy the entrypoint script
|
37 |
+
COPY entrypoint.sh /m3u-proxy/entrypoint.sh
|
38 |
+
|
39 |
+
# Make the entrypoint script executable
|
40 |
+
RUN chmod +x /m3u-proxy/entrypoint.sh
|
41 |
+
|
42 |
+
# Set PUID and PGID as environment variables
|
43 |
+
ENV PUID=1000
|
44 |
+
ENV PGID=1000
|
45 |
+
|
46 |
+
ENV PORT=8080
|
47 |
+
|
48 |
+
# The container entrypoint
|
49 |
+
ENTRYPOINT ["/m3u-proxy/entrypoint.sh", "/m3u-proxy/m3u-proxy"]
|