-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt fix dockerfile and add image to serverless config
- Loading branch information
1 parent
6d648a3
commit 289bc46
Showing
2 changed files
with
27 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,29 @@ | ||
FROM public.ecr.aws/lambda/go:1 as lambda | ||
|
||
# Copy over go source code | ||
COPY scraper/main.go /src/main.go | ||
COPY go.mod /src/go.mod | ||
COPY go.sum /src/go.sum | ||
FROM golang:1.22 AS builder | ||
|
||
WORKDIR /src | ||
|
||
# Install packages | ||
RUN yum install go xz atk cups-libs gtk3 libXcomposite alsa-lib tar \ | ||
libXcursor libXdamage libXext libXi libXrandr libXScrnSaver \ | ||
libXtst pango at-spi2-atk libXt xorg-x11-server-Xvfb \ | ||
xorg-x11-xauth dbus-glib dbus-glib-devel unzip bzip2 -y -q | ||
COPY scraper/main.go main.go | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
|
||
RUN GOARCH=amd64 GOOS=linux go build -ldflags="-s -w" -o app main.go | ||
|
||
FROM public.ecr.aws/lambda/go:1 | ||
|
||
# Build go lambda function | ||
RUN GOARCH=amd64 GOOS=linux go build -ldflags="-s -w" -o ${LAMBDA_TASK_ROOT} /src/main.go | ||
RUN yum install curl unzip | ||
|
||
# Install chrome | ||
RUN mkdir -p /opt/chrome/ | ||
RUN mkdir -p "/opt/chrome/" | ||
RUN curl -Lo "/opt/chrome/chrome-linux.zip" "https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F1299153%2Fchrome-linux.zip?generation=1715336417866122&alt=media" | ||
RUN unzip -q "/opt/chrome/chrome-linux.zip" -d "/opt/chrome/" | ||
RUN mv /opt/chrome/chrome-linux/* /opt/chrome/ | ||
RUN rm -rf /opt/chrome/chrome-linux "/opt/chrome/chrome-linux.zip" | ||
|
||
RUN yum install xz atk at-spi2-atk cups-libs gtk3 libXcomposite alsa-lib tar \ | ||
libXcursor libXdamage libXext libXi libXrandr libXScrnSaver \ | ||
libXtst pango at-spi2-atk libXt xorg-x11-server-Xvfb \ | ||
xorg-x11-xauth dbus-glib dbus-glib-devel unzip bzip2 -y -q | ||
|
||
# Copy over go source code | ||
COPY --from=builder /src/app /var/task/ | ||
|
||
CMD [ "app" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters