forked from beriberikix/zephyr-simulator-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (23 loc) · 711 Bytes
/
Dockerfile
File metadata and controls
37 lines (23 loc) · 711 Bytes
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
# Multi-stage Dockerfile for Go backend
FROM golang:1.25-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git make
# Copy go mod files
COPY go.mod go.sum ./
# Copy source code
COPY . .
ARG BACKEND_MAIN_TARGET=./cmd/server/main.go
# Build the application
RUN CGO_ENABLED=0 GOOS=linux GOMAXPROCS=2 GOMEMLIMIT=700MiB go build -trimpath -ldflags="-s -w" -o server "$BACKEND_MAIN_TARGET"
# Final stage
FROM alpine:3.19
RUN apk add --no-cache ca-certificates binutils docker-cli gdb
WORKDIR /app
# Copy binary from builder
COPY --from=builder /app/server .
EXPOSE 8080
ENV PORT=8080
ENV BASE_IMAGE_URL="zephyr-emulator:latest"
ENV RUNTIME_NAME="runsc"
CMD ["./server"]