Something went wrong. Try again.
Something went wrong. Try again.
effem-AppView Dockerfile
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677# The container image the service runs from (Railway builds it from this file;# see README.md).## `--build-system native` is required on Swift 6.4. The default build system# cannot link Foundation statically for this package (the link step ends in# undefined CFURLSession symbols), and it names resource bundles `.bundle`,# which the copy step below would not find. The flag prints a deprecation# warning; drop it together with `--static-swift-stdlib` when the base image# moves to a toolchain where the default build system links.## ================================# Build image# ================================FROM swift:6.4-noble AS build
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ && apt-get -q update \ && apt-get -q dist-upgrade -y \ && apt-get install -y libjemalloc-dev \ && rm -rf /var/lib/apt/lists/*
WORKDIR /build
# Resolve dependencies first so the layer is reused while the manifest is unchanged.COPY ./Package.* ./RUN swift package resolve
COPY . .
RUN swift build -c release \ --build-system native \ --product effem-appview \ --static-swift-stdlib \ -Xlinker -ljemalloc
WORKDIR /staging
RUN cp "$(swift build --build-system native --package-path /build -c release --show-bin-path)/effem-appview" ./RUN cp "/usr/libexec/swift/linux/swift-backtrace-static" ./
# Migrations, lexicons and the category list are SwiftPM resource bundles next to the binary.RUN find -L "$(swift build --build-system native --package-path /build -c release --show-bin-path)/" -regex '.*\.resources$' -exec cp -Ra {} ./ \;
# Without the bundle the server traps at start ("could not load resource bundle"), so fail the build instead.RUN test -d ./AppView_EffemAppView.resources/Migrations
# ================================# Run image# ================================FROM ubuntu:noble
# libcurl4 backs FoundationNetworking, which CoreATProtocol and PodcastIndexKit use on Linux.RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ && apt-get -q update \ && apt-get -q dist-upgrade -y \ && apt-get -q install -y \ libjemalloc2 \ ca-certificates \ tzdata \ libcurl4 \ && rm -r /var/lib/apt/lists/*
RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app effem
WORKDIR /app
COPY --from=build --chown=effem:effem /staging /app
ENV SWIFT_BACKTRACE=enable=yes,sanitize=yes,threads=all,images=all,interactive=no,swift-backtrace=./swift-backtrace-static
USER effem:effem
EXPOSE 8080
# Every setting comes from EFFEM_* environment variables; see README.md.ENTRYPOINT ["./effem-appview"]