-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (27 loc) · 960 Bytes
/
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
# Use the official Golang image as the base image
FROM golang:1.22 as builder
# Set the working directory inside the container
WORKDIR /app
# Copy the Go modules manifests and download the modules
COPY go.mod go.sum ./
RUN go mod download
# Copy the source code
COPY . .
# Install templ and generate templates
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN templ generate
# Build the application
RUN CGO_ENABLED=0 GOOS=linux go build -o ai-tracker
# Use ubuntu as the base image due chrome dependencies
FROM alpine:latest
# Set the working directory inside the container
WORKDIR /root/
# Copy the built Go application and necessary files from the builder stage
COPY --from=builder /app/ai-tracker /app/websites.json /app/words.json ./
COPY --from=builder /app/website/static ./website/static
# Install chromium
RUN apk --no-cache add chromium
# Expose the application port
EXPOSE 8080
# Command to run the application
CMD ["./ai-tracker"]