-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.backend
38 lines (28 loc) · 1.06 KB
/
Dockerfile.backend
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
FROM golang:1.18.3-alpine
WORKDIR /app
# Install required system dependencies
RUN apk add --no-cache git docker-cli
# Create backend directory structure
RUN mkdir -p pkg/handlers cmd/server internal/api internal/system data/logos templates
# Create go.mod file
RUN go mod init wagmios
# Add required dependencies
RUN go get github.com/gorilla/[email protected] && \
go get github.com/rs/[email protected] && \
go get github.com/joho/[email protected] && \
go get github.com/lib/[email protected] && \
go get github.com/go-redis/redis/[email protected]
# Copy the application code
COPY backend-go/ ./
# Modify the chat.go file to use environment variable for WILLOW URL
RUN if [ -f pkg/handlers/chat.go ]; then \
sed -i 's|"http://localhost:5678/webhook/wagmios-chat"|os.Getenv("WILLOW_URL") + "/webhook/wagmios-chat"|g' pkg/handlers/chat.go && \
sed -i '1,10s|import (|import (\n "os"|' pkg/handlers/chat.go; \
fi
# Build the application
RUN go mod tidy && \
go build -o main ./cmd/server/main.go
# Expose the port
EXPOSE 5179
# Command to run the app
CMD ["./main"]