Skip to content

Commit

Permalink
update code 04/2023
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Phong <[email protected]>
  • Loading branch information
NguyenPhongVN committed Apr 12, 2023
1 parent 9b4cf4a commit 79c6d3e
Show file tree
Hide file tree
Showing 12 changed files with 427 additions and 417 deletions.
26 changes: 19 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# ================================
# Build image
# ================================
FROM swift:5.5-focal as build
FROM swift:5.7-jammy as build

# Install OS updates and, if needed, sqlite3
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
&& apt-get -q update \
&& apt-get -q dist-upgrade -y \
&& apt-get -q dist-upgrade -y\
&& rm -rf /var/lib/apt/lists/*

# Set up a build area
Expand All @@ -23,14 +23,17 @@ RUN swift package resolve
COPY . .

# Build everything, with optimizations
RUN swift build -c release
RUN swift build -c release --static-swift-stdlib

# Switch to the staging area
WORKDIR /staging

# Copy main executable to staging area
RUN cp "$(swift build --package-path /build -c release --show-bin-path)/Run" ./

# Copy resources bundled by SPM to staging area
RUN find -L "$(swift build --package-path /build -c release --show-bin-path)/" -regex '.*\.resources$' -exec cp -Ra {} ./ \;

# Copy any resources from the public directory and views directory if the directories exist
# Ensure that by default, neither the directory nor any of its contents are writable.
RUN [ -d /build/Public ] && { mv /build/Public ./Public && chmod -R a-w ./Public; } || true
Expand All @@ -39,11 +42,20 @@ RUN [ -d /build/Resources ] && { mv /build/Resources ./Resources && chmod -R a-w
# ================================
# Run image
# ================================
FROM swift:5.5-focal-slim
FROM ubuntu:jammy

# Make sure all system packages are up to date.
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && \
apt-get -q update && apt-get -q dist-upgrade -y && rm -r /var/lib/apt/lists/*
# Make sure all system packages are up to date, and install only essential packages.
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
&& apt-get -q update \
&& apt-get -q dist-upgrade -y \
&& apt-get -q install -y \
ca-certificates \
tzdata \
# If your app or its dependencies import FoundationNetworking, also install `libcurl4`.
# libcurl4 \
# If your app or its dependencies import FoundationXML, also install `libxml2`.
# libxml2 \
&& rm -r /var/lib/apt/lists/*

# Create a vapor user and group with /app as its home directory
RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor
Expand Down
154 changes: 77 additions & 77 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,251 +6,251 @@
"repositoryURL": "https://github.com/swift-server/async-http-client.git",
"state": {
"branch": null,
"revision": "70826d038d5bdc3142a386b735792d87ef7a5dfc",
"version": "1.8.1"
"revision": "864c8d9e0ead5de7ba70b61c8982f89126710863",
"version": "1.15.0"
}
},
{
"package": "async-kit",
"repositoryURL": "https://github.com/vapor/async-kit.git",
"state": {
"branch": null,
"revision": "e2f741640364c1d271405da637029ea6a33f754e",
"version": "1.11.1"
"revision": "9acea4c92f51a5885c149904f0d11db4712dda80",
"version": "1.16.0"
}
},
{
"package": "console-kit",
"repositoryURL": "https://github.com/vapor/console-kit.git",
"state": {
"branch": null,
"revision": "75ea3b627d88221440b878e5dfccc73fd06842ed",
"version": "4.2.7"
"revision": "447f1046fb4e9df40973fe426ecb24a6f0e8d3b4",
"version": "4.6.0"
}
},
{
"package": "fluent",
"repositoryURL": "https://github.com/vapor/fluent.git",
"state": {
"branch": null,
"revision": "ea707ee318066a073c95b2b2df1aa640fcb67f9e",
"version": "4.4.0"
"revision": "8d6015096200b4c2f17b884eb966defc42a2ad1d",
"version": "4.7.1"
}
},
{
"package": "fluent-kit",
"repositoryURL": "https://github.com/vapor/fluent-kit.git",
"state": {
"branch": null,
"revision": "d5273e8d050c51dd7e1d3a4dab08fe32ec9ffffa",
"version": "1.20.0"
"revision": "21d99b0c66cf86867a779bac831d800aac22f5e6",
"version": "1.41.0"
}
},
{
"package": "fluent-postgres-driver",
"repositoryURL": "https://github.com/vapor/fluent-postgres-driver.git",
"state": {
"branch": null,
"revision": "131e154a2263591fe2a0b87148e3dcbf43d6c9f7",
"version": "2.2.2"
}
},
{
"package": "HTMLKitComponents",
"repositoryURL": "https://github.com/vapor-community/HTMLKit-Components.git",
"state": {
"branch": "main",
"revision": "4fb8ea3b98a9fa03367017cd89629707924541b1",
"version": null
}
},
{
"package": "HTMLKitVaporProvider",
"repositoryURL": "https://github.com/vapor-community/htmlkit-vapor-provider.git",
"state": {
"branch": null,
"revision": "f0d85193b0cc87d05668153d3b76a94ffc3f1493",
"version": "1.2.1"
"revision": "f2b084417472e6a153d555905796f0ef0bb6fc37",
"version": "2.5.1"
}
},
{
"package": "leaf",
"repositoryURL": "https://github.com/vapor/leaf.git",
"state": {
"branch": null,
"revision": "ffff1a882ab880e2c4f919a82cd60518912e6499",
"version": "4.1.4"
"revision": "6fe0e843c6599f5189e45c7b08739ebc5c410c3b",
"version": "4.2.4"
}
},
{
"package": "leaf-kit",
"repositoryURL": "https://github.com/vapor/leaf-kit.git",
"state": {
"branch": null,
"revision": "983fcbe89e7153c4d5870bdc76bf57a56817225f",
"version": "1.4.0"
}
},
{
"package": "Lingo",
"repositoryURL": "https://github.com/miroslavkovac/Lingo.git",
"state": {
"branch": null,
"revision": "e4b032f65bde917209a1cb0962c0fd13fa0add2f",
"version": "3.1.0"
"revision": "13f2fc4c8479113cd23876d9a434ef4573e368bb",
"version": "1.10.2"
}
},
{
"package": "multipart-kit",
"repositoryURL": "https://github.com/vapor/multipart-kit.git",
"state": {
"branch": null,
"revision": "2dd9368a3c9580792b77c7ef364f3735909d9996",
"version": "4.5.1"
"revision": "3a31859efeb054cdcd407fe152802ddc5c58bbce",
"version": "4.5.3"
}
},
{
"package": "postgres-kit",
"repositoryURL": "https://github.com/vapor/postgres-kit.git",
"state": {
"branch": null,
"revision": "70ce73449fc559028aaa7da52096288974ebb5e0",
"version": "2.5.0"
"revision": "8ea9274633374d01bdef10da3206db74f3e261d6",
"version": "2.9.1"
}
},
{
"package": "postgres-nio",
"repositoryURL": "https://github.com/vapor/postgres-nio.git",
"state": {
"branch": null,
"revision": "780a510863bfc00b2239b649df4f403080c4bc9c",
"version": "1.7.2"
"revision": "5d93f3e05f0493441ad46f6d7a76109ff685329c",
"version": "1.13.0"
}
},
{
"package": "routing-kit",
"repositoryURL": "https://github.com/vapor/routing-kit.git",
"state": {
"branch": null,
"revision": "5603b81ceb744b8318feab1e60943704977a866b",
"version": "4.3.1"
"revision": "611bc45c5dfb1f54b84d99b89d1f72191fb6b71b",
"version": "4.7.2"
}
},
{
"package": "sql-kit",
"repositoryURL": "https://github.com/vapor/sql-kit.git",
"state": {
"branch": null,
"revision": "9cc30f8cef132e91a07e36005612b37f918731fc",
"version": "3.16.0"
"revision": "fcc29f543b3de7b661cbe7540805974234cb9740",
"version": "3.24.0"
}
},
{
"package": "swift-algorithms",
"repositoryURL": "https://github.com/apple/swift-algorithms.git",
"state": {
"branch": null,
"revision": "b14b7f4c528c942f121c8b860b9410b2bf57825e",
"version": "1.0.0"
}
},
{
"package": "swift-atomics",
"repositoryURL": "https://github.com/apple/swift-atomics.git",
"state": {
"branch": null,
"revision": "6c89474e62719ddcc1e9614989fff2f68208fe10",
"version": "1.1.0"
}
},
{
"package": "swift-backtrace",
"repositoryURL": "https://github.com/swift-server/swift-backtrace.git",
"state": {
"branch": null,
"revision": "d3e04a9d4b3833363fb6192065b763310b156d54",
"version": "1.3.1"
"revision": "f25620d5d05e2f1ba27154b40cafea2b67566956",
"version": "1.3.3"
}
},
{
"package": "swift-collections",
"repositoryURL": "https://github.com/apple/swift-collections.git",
"state": {
"branch": null,
"revision": "48254824bb4248676bf7ce56014ff57b142b77eb",
"version": "1.0.2"
"revision": "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version": "1.0.4"
}
},
{
"package": "swift-crypto",
"repositoryURL": "https://github.com/apple/swift-crypto.git",
"state": {
"branch": null,
"revision": "a8911e0fadc25aef1071d582355bd1037a176060",
"version": "2.0.4"
"revision": "da0fe44138ab86e380f40a2acbd8a611b07d3f64",
"version": "2.4.0"
}
},
{
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "5d66f7ba25daf4f94100e7022febf3c75e37a6c7",
"version": "1.4.2"
"revision": "32e8d724467f8fe623624570367e3d50c5638e46",
"version": "1.5.2"
}
},
{
"package": "swift-metrics",
"repositoryURL": "https://github.com/apple/swift-metrics.git",
"state": {
"branch": null,
"revision": "3edd2f57afc4e68e23c3e4956bc8b65ca6b5b2ff",
"version": "2.2.0"
"revision": "e8bced74bc6d747745935e469f45d03f048d6cbd",
"version": "2.3.4"
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "51c3fc2e4a0fcdf4a25089b288dd65b73df1b0ef",
"version": "2.37.0"
"revision": "9b2848d76f5caad08b97e71a04345aa5bdb23a06",
"version": "2.49.0"
}
},
{
"package": "swift-nio-extras",
"repositoryURL": "https://github.com/apple/swift-nio-extras.git",
"state": {
"branch": null,
"revision": "f73ca5ee9c6806800243f1ac415fcf82de9a4c91",
"version": "1.10.2"
"revision": "cc1e5275079380c859417dbea8588531f1a90ec3",
"version": "1.18.0"
}
},
{
"package": "swift-nio-http2",
"repositoryURL": "https://github.com/apple/swift-nio-http2.git",
"state": {
"branch": null,
"revision": "6e94a7be32891d1b303a3fcfde8b5bf64d162e74",
"version": "1.19.1"
"revision": "38feec96bcd929028939107684073554bf01abeb",
"version": "1.25.2"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "52a486ff6de9bc3e26bf634c5413c41c5fa89ca5",
"version": "2.17.2"
"revision": "4fb7ead803e38949eb1d6fabb849206a72c580f3",
"version": "2.23.0"
}
},
{
"package": "swift-nio-transport-services",
"repositoryURL": "https://github.com/apple/swift-nio-transport-services.git",
"state": {
"branch": null,
"revision": "8ab824b140d0ebcd87e9149266ddc353e3705a3e",
"version": "1.11.4"
"revision": "c0d9a144cfaec8d3d596aadde3039286a266c15c",
"version": "1.15.0"
}
},
{
"package": "swift-numerics",
"repositoryURL": "https://github.com/apple/swift-numerics",
"state": {
"branch": null,
"revision": "0a5bc04095a675662cf24757cc0640aa2204253b",
"version": "1.0.2"
}
},
{
"package": "vapor",
"repositoryURL": "https://github.com/vapor/vapor.git",
"state": {
"branch": null,
"revision": "572aba071e93662d6fb1d6fb82ec79e9741d72ca",
"version": "4.54.2"
"revision": "ba1a308a58ba9d78c5100588d7d8b6e615a98248",
"version": "4.75.0"
}
},
{
"package": "websocket-kit",
"repositoryURL": "https://github.com/vapor/websocket-kit.git",
"state": {
"branch": null,
"revision": "ff8fbce837ef01a93d49c6fb49a72be0f150dac7",
"version": "2.3.0"
"revision": "2b8885974e8d9f522e787805000553f4f7cce8a0",
"version": "2.7.0"
}
}
]
Expand Down
Loading

0 comments on commit 79c6d3e

Please sign in to comment.