Files
openfsd/Dockerfile
Reese Norris 57d54d6705 v0.1.0-alpha
Changes:
- Implement bootstrapping library for managing several concurrent internal services
- Refactor concurrency model for connections/logical clients and their associated I/O
- Refactor server context singleton
- Refactor error handling
    - Most errors are now gracefully sent to the FSD client directly encoded as an $ER packet,
      enhancing visibility and debugging
    - Most errors are now rightfully treated as non-fatal
- Refactor package/dependency graph
- Refactor calling conventions/interfaces for many packages
- Refactor database package
- Refactor post office

Features:
- Add VATSIM-esque HTTP/JSON "data feed"
- Add ephemeral in-memory database option
- Add user management REST API
- Add improved web interface
- Add MySQL support (drop SQLite support)
2024-10-07 12:50:39 -07:00

44 lines
1.2 KiB
Docker

# Fetch UPX
FROM alpine:latest AS upx
WORKDIR /
RUN apk update && apk add ca-certificates && \
arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/amd64/) && echo "ARCHITECTURE=${arch}" && \
wget "https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-${arch}_linux.tar.xz" && \
tar -xf upx-4.2.4-${arch}_linux.tar.xz && \
cd upx-4.2.4-${arch}_linux && \
mv upx /bin/upx
# Build openfsd
FROM golang:1.23.2-bookworm AS build
# Precompile the entire go standard library into the first Docker cache layer
RUN CGO_ENABLED=0 GOOS=linux go install -v -a std
WORKDIR /go/src/openfsd
# Download and precompile all third party libraries
COPY go.mod .
COPY go.sum .
RUN go mod download -x
RUN go list -m all | tail -n +2 | cut -f 1 -d " " | awk 'NF{print $0 "/..."}' | CGO_ENABLED=0 GOOS=linux xargs -n1 go build -v; echo done
# Add the sources
COPY . .
# Compile
RUN CGO_ENABLED=0 GOOS=linux go build -v -o openfsd -ldflags "-s -w" main.go
# Move UPX into /bin
COPY --from=upx /bin/upx /bin/upx
# Compress with upx
RUN /bin/upx -v -9 openfsd
FROM gcr.io/distroless/static-debian12
WORKDIR /app
COPY --from=build --chown=nonroot:nonroot /go/src/openfsd /app
USER nonroot:nonroot
ENTRYPOINT ["/app/openfsd"]