-
Notifications
You must be signed in to change notification settings - Fork 577
/
Dockerfile_next
51 lines (37 loc) · 1.18 KB
/
Dockerfile_next
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
49
50
# Stage 1: Builder
FROM golang:1.22.4 AS builder
# Build arguments
ARG COMMIT_SHA
RUN echo "Commit SHA: ${COMMIT_SHA}"
# Set the working directory
WORKDIR $GOPATH/src/github.com/diggerhq/digger
# copy the application
COPY . .
RUN go mod download
# Build the static binary
RUN go build -ldflags="-X 'main.Version=${COMMIT_SHA}'" -o next_exe ./next/
# Stage 2: Runner
FROM ubuntu:24.04 AS runner
ENV ATLAS_VERSION v0.28.0
ARG COMMIT_SHA
WORKDIR /app
# Install necessary packages and clean up in a single step
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates curl git && \
rm -rf /var/lib/apt/lists/* && \
update-ca-certificates
# Print commit SHA
RUN echo "Commit SHA: ${COMMIT_SHA}"
# Install Atlas
RUN curl -sSf https://atlasgo.sh | sh
#ENV GIN_MODE=release
# Expose the running port
EXPOSE 3000
# Copy binary and entrypoint
COPY --from=builder /go/src/github.com/diggerhq/digger/next_exe /app/next
COPY --from=builder /go/src/github.com/diggerhq/digger/next/scripts/entrypoint.sh /app/entrypoint.sh
ADD next/templates ./templates
# Set entrypoint and permissions
RUN chmod +x /app/entrypoint.sh
ENTRYPOINT ["/bin/bash", "/app/entrypoint.sh"]