-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
41 lines (30 loc) · 1.01 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
# Use the official Golang image as a parent image
FROM golang:1.23.1-alpine
# Install Chromium and necessary libraries
RUN apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ttf-freefont
# Set environment variables for Chrome
ENV CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/usr/lib/chromium/
# Grant permissions if Chromedp has issues running headlessly
RUN chmod -R 777 /usr/bin/chromium-browser
# Set the working directory inside the container
WORKDIR /app
# Copy only necessary files to leverage Docker cache more effectively
COPY src/go.mod src/go.sum ./
# Download all dependencies first, leveraging Docker caching
RUN go mod download
# Copy the rest of the source code into the container
COPY src/ /app/src
# Set the working directory to where main.go is located
WORKDIR /app/src
# Build the application (output as "main" instead of "main.go")
RUN go build -o main .
# Expose the port that the application listens on
EXPOSE 8443
# Command to run the application
CMD ["./main"]