-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
58 lines (48 loc) · 1.47 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
50
51
52
53
54
55
56
57
58
# Start from a Debian image with the latest version of Go installed
FROM golang:1.21-alpine
# Install git and ca-certificates
RUN apk add --no-cache git ca-certificates
# Set the working directory inside the container
WORKDIR /app
# Copy go.mod and go.sum files
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy the entire project
COPY . .
# Declare build-time ARGs
ARG APP_ID
ARG APP_CERTIFICATE
ARG CUSTOMER_ID
ARG CUSTOMER_SECRET
ARG SERVER_PORT
ARG CORS_ALLOW_ORIGIN
ARG AGORA_BASE_URL
ARG AGORA_CLOUD_RECORDING_URL
ARG AGORA_RTT_URL
ARG STORAGE_VENDOR
ARG STORAGE_REGION
ARG STORAGE_BUCKET
ARG STORAGE_BUCKET_ACCESS_KEY
ARG STORAGE_BUCKET_SECRET_KEY
# Set them as persistent ENV variables
ENV APP_ID=$APP_ID \
APP_CERTIFICATE=$APP_CERTIFICATE \
CUSTOMER_ID=$CUSTOMER_ID \
CUSTOMER_SECRET=$CUSTOMER_SECRET \
SERVER_PORT=$SERVER_PORT \
CORS_ALLOW_ORIGIN=$CORS_ALLOW_ORIGIN \
AGORA_BASE_URL=$AGORA_BASE_URL \
AGORA_CLOUD_RECORDING_URL=$AGORA_CLOUD_RECORDING_URL \
AGORA_RTT_URL=$AGORA_RTT_URL \
STORAGE_VENDOR=$STORAGE_VENDOR \
STORAGE_REGION=$STORAGE_REGION \
STORAGE_BUCKET=$STORAGE_BUCKET \
STORAGE_BUCKET_ACCESS_KEY=$STORAGE_BUCKET_ACCESS_KEY \
STORAGE_BUCKET_SECRET_KEY=$STORAGE_BUCKET_SECRET_KEY
# Build the application
RUN go build -v -o agora-backend-middleware ./cmd/main.go
# Run the application
CMD ["./agora-backend-middleware"]
# Document that the service listens on the specified port
EXPOSE $SERVER_PORT