-
Notifications
You must be signed in to change notification settings - Fork 10
/
Dockerfile
48 lines (35 loc) · 1.13 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
42
43
44
45
46
47
48
FROM golang:1.21-bookworm as builder
ARG IGNITE_VERSION="28.1.0"
# Ignite CLI prompts users for tracking info which hangs the tty
# See https://github.com/ignite/cli/blob/main/ignite/internal/analytics/analytics.go#L71
ENV DO_NOT_TRACK=1
# Set DEV="1" to install ignite cli for the dev container
ARG DEV=0
# Setup env and dev tools
RUN apt update &&\
apt-get install --yes git make curl jq; \
if [ "$DEV" = "1" ]; then\
mkdir /env &&\
cd /env &&\
curl -L https://github.com/ignite/cli/releases/download/v${IGNITE_VERSION}/ignite_${IGNITE_VERSION}_linux_amd64.tar.gz > ignite.tar.gz &&\
tar xvf ignite.tar.gz &&\
mv ignite /usr/local/bin/ignite &&\
cd / && rm -rf /env;\
fi
WORKDIR /app
# Cache deps
COPY go.* /app/
RUN go mod download
# Build
COPY . /app
RUN --mount=type=cache,target=/root/.cache make build
# Dev image entrypoint
ENTRYPOINT ["scripts/dev-entrypoint.sh"]
CMD ["start"]
# Deployment entrypoint
FROM debian:bookworm-slim
RUN useradd -ms /bin/bash node
USER node
COPY --from=builder /app/build/sourcehubd /usr/local/bin/sourcehubd
ENTRYPOINT ["sourcehubd"]
CMD ["start"]