feat: Adds Dockerfile.
This commit is contained in:
27
Dockerfile
Normal file
27
Dockerfile
Normal file
@@ -0,0 +1,27 @@
|
||||
FROM swift:5.10 AS build
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# First just resolve dependencies.
|
||||
COPY ./Package.* ./
|
||||
RUN --mount=type=cache,target=/build/.build swift package resolve \
|
||||
$([ -f ./Package.resolved ] && echo "--force-resolved-versions" || true)
|
||||
|
||||
# Copy entire repo into container
|
||||
COPY . .
|
||||
|
||||
# Build the static site.
|
||||
RUN --mount=type=cache,target=/build/.build swift run
|
||||
|
||||
# ==================================================
|
||||
# Run Image
|
||||
# ==================================================
|
||||
FROM caddy:2.9.1-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /build/deploy .
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["/usr/bin/caddy", "file-server", "--root", "/app", "--listen", ":80"]
|
||||
Reference in New Issue
Block a user