-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.dev
50 lines (35 loc) · 1.01 KB
/
Dockerfile.dev
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
50
# Stage 1: Build stage
FROM golang:1.23-alpine AS builder
# Install git
RUN apk update && apk add --no-cache git
# Set the working directory
WORKDIR /go/src/github.com/arturmon/s3MediaStreamer
# Clone the repository
RUN git clone --single-branch --branch main https://github.com/arturmon/s3MediaStreamer.git .
RUN go mod download
# Build the application
RUN go build -C ./app -v -o /app/s3stream
# Stage 2: Final stage
FROM alpine:3.20.3
LABEL author="Artur Mudrykh"
# Add user
RUN adduser -D -g '' appuser
RUN mkdir -p /app
WORKDIR /app
# Copy the built binary from the builder stage
COPY --from=builder /app/s3stream ./s3stream
COPY conf/ conf/
COPY /migrations/psql/ ./migrations/psql/
COPY acl/ acl/
# Set permissions
RUN chown appuser: /app && \
chmod +x /app/s3stream
# Switch to non-root user
USER appuser
# Expose the port
EXPOSE 10000
# Health check
HEALTHCHECK --interval=30s --timeout=3s \
CMD wget -qO- http://localhost:10000/health/liveness || exit 1
# Entrypoint command
ENTRYPOINT ["/app/s3stream"]