Skip to content

Instantly share code, notes, and snippets.

@rohitpaulk
Created February 4, 2020 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohitpaulk/605e1a564127784e5bbfcd20291338bb to your computer and use it in GitHub Desktop.
Save rohitpaulk/605e1a564127784e5bbfcd20291338bb to your computer and use it in GitHub Desktop.
Swift build madness
RUN mkdir /root/Scribble-Server
ADD Tests /root/Scribble-Server/Tests
ADD Package.swift /root/Scribble-Server
ADD Package.resolved /root/Scribble-Server
# Add a dummy file for resolving dependencies and pre-building first
ADD Sources/DummyForDependencies/main.swift /root/Scribble-Server/Sources/ScribbleServer/main.swift
ADD Sources/DummyForDependencies/DummyModel.swift /root/Scribble-Server/Sources/CanvasModel/DummyModel.swift
# Resolve the dependencies by building using the dummy sources
RUN cd /root/Scribble-Server && export KITURA_NIO=1 && swift build -c release
# Delete the dummy sources
RUN rm /root/Scribble-Server/Sources/ScribbleServer/main.swift
RUN rm /root/Scribble-Server/Sources/CanvasModel/DummyModel.swift
# Add in the real sources
ADD Sources /root/Scribble-Server/Sources
RUN rm -rf /root/Scribble-Server/Sources/DummyForDependencies
# Build again. This unfortunately rebuilds all dependencies, even though they haven't changed
RUN cd /root/Scribble-Server && export KITURA_NIO=1 && swift build -c release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment