-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
49 lines (35 loc) · 1.22 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
# Start from the official Golang image
FROM golang:alpine AS build
# Set the Current Working Directory inside the container
WORKDIR /app
# Copy go mod and sum files
COPY go.mod go.sum ./
# Download all dependencies. Dependencies will be cached if the go.mod and go.sum files are not changed
RUN go mod download
# Copy the source code from the current directory to the Working Directory inside the container
COPY . .
# test and build the app.
RUN go test ./tests/... && go build -ldflags='-s -w' -o m3u-proxy .
# End from the latest alpine image
# hadolint ignore=DL3007
FROM alpine:latest
# add bash and timezone data
# hadolint ignore=DL3018
RUN apk --no-cache add tzdata \
ca-certificates \
su-exec \
&& update-ca-certificates \
# set the current workdir
WORKDIR /m3u-proxy
# copy in our compiled GO app
COPY --from=build /app/m3u-proxy /m3u-proxy/
# Copy the entrypoint script
COPY entrypoint.sh /m3u-proxy/entrypoint.sh
# Make the entrypoint script executable
RUN chmod +x /m3u-proxy/entrypoint.sh
# Set PUID and PGID as environment variables
ENV PUID=1000
ENV PGID=1000
ENV PORT=8080
# The container entrypoint
ENTRYPOINT ["/m3u-proxy/entrypoint.sh", "/m3u-proxy/m3u-proxy"]