-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
90 lines (68 loc) · 2.09 KB
/
Dockerfile
File metadata and controls
90 lines (68 loc) · 2.09 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Build stage
FROM golang:1.24.0-bullseye AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
git \
make \
gcc \
libc6-dev \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Copy source code
COPY go.mod go.sum ./
# Download dependencies
RUN go mod download
# Copy source code
COPY . .
# Build arguments for version and commit
ARG VERSION
ARG COMMIT
# Set environment variables for build
ENV VERSION=${VERSION}
ENV COMMIT=${COMMIT}
# Build the application
RUN make build
# Final stage
FROM debian:bullseye-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
tzdata \
wget \
gosu \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user
RUN groupadd -g 1000 sequoia && \
useradd -r -u 1000 -g sequoia -s /bin/sh sequoia
# Set working directory
WORKDIR /app
# Copy binary from builder stage
COPY --from=builder /app/sequoia .
# Copy entrypoint script
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
# Copy required shared libraries from wasmvm
RUN mkdir -p /usr/local/lib
COPY --from=builder /go/pkg/mod/github.com/\!cosm\!wasm/wasmvm@v1.2.6/internal/api/libwasmvm.*.so /usr/local/lib/
RUN ldconfig
# Create necessary directories with proper permissions
RUN mkdir -p /home/sequoia/.sequoia/data && \
mkdir -p /home/sequoia/.sequoia/blockstore && \
mkdir -p /home/sequoia/.sequoia/config && \
mkdir -p /home/sequoia/.sequoia/logs && \
chown -R sequoia:sequoia /home/sequoia && \
chown -R sequoia:sequoia /app && \
chmod -R 755 /home/sequoia/.sequoia
# Note: User switching is handled by the entrypoint script
# Expose ports
EXPOSE 3333 4005 4001
# Set environment variables
ENV HOME=/home/sequoia
ENV SEQUOIA_HOME=/home/sequoia/.sequoia
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3333/health || exit 1
# Set entrypoint and default command
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["./sequoia", "start"]