-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
41 lines (30 loc) · 1.08 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
# base image - stage 0
FROM golang:1.22-alpine AS build
# current working dir
WORKDIR /app
COPY . .
# Install necessary dependencies and build
RUN apk --no-cache add gcompat build-base \
&& wget https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 \
&& chmod +x tailwindcss-linux-x64 \
&& mv tailwindcss-linux-x64 tailwindcss \
&& go install github.com/a-h/templ/cmd/templ@latest \
&& make build
# runtime image
FROM alpine:3.18 AS final
# isntall chromium
RUN apk update && apk upgrade \
&& apk add --no-cache chromium
# workdir in the runtime image
WORKDIR /app
# copy contents from stage 0
COPY --from=build /app ./
# Set environment variables
ENV CHROME_PATH=/usr/bin/chromium-browser
# Ensure the binary has executable permissions
RUN chmod +x ./bin/scrapper
# render.com passes the environment variable as an argument
ARG ENVIRONMENT=docker
ENV ENVIRONMENT=docker
# run the server
CMD ["./bin/scrapper"]