-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile
40 lines (31 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
FROM golang:1.23.2-bullseye AS gobuild
# install dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends g++ make gcc git build-essential ca-certificates curl \
&& update-ca-certificates
ENV GO111MODULE=on
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
# static build
ADD . .
ENV GOOS=linux
ENV GOARCH=amd64
RUN go build -a -ldflags '-w -extldflags "-static"' -o main main.go
# copy executable file and certs to a pure container
FROM node:22-bullseye AS vitebuilder
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates haveged \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# install ardrive cli
RUN npm install -g ardrive-cli
COPY --from=gobuild /etc/ssl/certs /etc/ssl/certs
COPY --from=gobuild /app/main /app/go-graphql-srv
WORKDIR /app
RUN chmod +rx -R /app && \
adduser --disabled-password --gecos '' laisky
USER laisky
ENTRYPOINT [ "/app/go-graphql-srv" ]
CMD [ "api", "-c", "/etc/laisky-blog-graphql/settings.yml" ]