-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
38 lines (32 loc) · 1.02 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# ================================
# Build image
# ================================
FROM swift:5.7.2 as build
WORKDIR /build
# First just resolve dependencies.
# This creates a cached layer that can be reused
# as long as your Package.swift/Package.resolved
# files do not change.
COPY ./PufferyServer/Package.* ./
COPY ./APIDefinition ../APIDefinition
RUN swift package resolve
# Copy entire repo into container
COPY ./PufferyServer .
# Compile with optimizations
RUN swift build \
--enable-test-discovery \
-c release \
-Xswiftc -g
# ================================
# Run image
# ================================
FROM ubuntu:22.10
WORKDIR /app
# Copy build artifacts
COPY --from=build /build/.build/release /app
# Copy Swift runtime libraries
COPY --from=build /usr/lib/swift/ /usr/lib/swift/
# Uncomment the next line if you need to load resources from the `Public` directory
#COPY --from=build /build/Public /app/Public
ENTRYPOINT ["./puffery"]
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--auto-migrate"]