-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
43 lines (35 loc) · 1.32 KB
/
dockerfile
File metadata and controls
43 lines (35 loc) · 1.32 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
# --------------------------------------------------------
# STAGE 1: Build the Gateway (Using Go 1.24)
# This satisfies your go.mod requirement.
# --------------------------------------------------------
FROM golang:1.24-bookworm AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Build the binary
RUN go build -o gateway ./cmd/gateway
# --------------------------------------------------------
# STAGE 2: Runtime Environment (Using Go 1.23)
# We use Go 1.23 here specifically because TinyGo needs
# the Go 1.23 source code (/usr/local/go) to compile WASM.
# --------------------------------------------------------
FROM golang:1.23-bookworm
# 1. Install dependencies
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/*
# 2. Install TinyGo 0.33.0
# This version works perfectly with the Go 1.23 environment we provided above
ENV TINYGO_VERSION=0.33.0
RUN wget https://github.com/tinygo-org/tinygo/releases/download/v${TINYGO_VERSION}/tinygo_${TINYGO_VERSION}_amd64.deb \
&& dpkg -i tinygo_${TINYGO_VERSION}_amd64.deb \
&& rm tinygo_${TINYGO_VERSION}_amd64.deb
# 3. Setup App
WORKDIR /app
# Copy the binary compiled in Stage 1
COPY --from=builder /app/gateway .
# 4. Create configs directory
RUN mkdir -p configs
# 5. Expose Ports
EXPOSE 8080 9090
# 6. Run
CMD ["./gateway", "configs"]