Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ WORKDIR /build
# as long as your Package.swift/Package.resolved
# files do not change.
COPY ./Package.* ./
RUN swift package resolve
RUN swift package resolve --skip-update \
"$([ -f ./Package.resolved ] && echo "--force-resolved-versions" || true)"

# Copy entire repo into container
COPY . .

# Compile with optimizations
RUN swift build -c release --static-swift-stdlib
RUN swift build -c release --static-swift-stdlib \
# Workaround for https://github.com/apple/swift/pull/68669
# This can be removed as soon as 5.9.1 is released, but is harmless if left in.
-Xlinker -u -Xlinker _swift_backtrace_isThunkFunction

# Switch to the staging area
WORKDIR /staging
Expand Down Expand Up @@ -72,6 +76,9 @@ WORKDIR /app
# COPY --from=build --chown=vapor:vapor /staging /app
COPY --from=build /staging /app

# Provide configuration needed by the built-in crash reporter and some sensible default behaviors.
ENV SWIFT_ROOT=/usr SWIFT_BACKTRACE=enable=yes,sanitize=yes,threads=all,images=all,interactive=no

# Ensure all further commands run as the vapor user
# NB sas 2022-09-23: See above why we're not using the `vapor` user
# USER vapor:vapor
Expand Down
6 changes: 6 additions & 0 deletions Sources/Run/entrypoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import Vapor
import Dispatch
import Logging

#if swift(>=5.9.1)
// For lack of a better place to put this reminder about Dockerfile changes
// https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/pull/2636
#warning("Review backtrace changes in Dockerfile")
#endif

/// This extension is temporary and can be removed once Vapor gets this support.
private extension Vapor.Application {
static let baseExecutionQueue = DispatchQueue(label: "vapor.codes.entrypoint")
Expand Down