Skip to content

Commit c1bddf9

Browse files
Integrate web playground
1 parent 734b967 commit c1bddf9

35 files changed

+801
-302
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.build/
2+
.swiftpm/

.gitignore

+7-122
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,9 @@
1-
### https://raw.github.com/github/gitignore/218a941be92679ce67d0484547e3e142b2f5f6f0/Global/macOS.gitignore
2-
3-
# General
4-
.DS_Store
5-
.AppleDouble
6-
.LSOverride
7-
8-
# Icon must end with two \r
9-
Icon
10-
11-
# Thumbnails
12-
._*
13-
14-
# Files that might appear in the root of a volume
15-
.DocumentRevisions-V100
16-
.fseventsd
17-
.Spotlight-V100
18-
.TemporaryItems
19-
.Trashes
20-
.VolumeIcon.icns
21-
.com.apple.timemachine.donotpresent
22-
23-
# Directories potentially created on remote AFP share
24-
.AppleDB
25-
.AppleDesktop
26-
Network Trash Folder
27-
Temporary Items
28-
.apdisk
29-
30-
31-
### https://raw.github.com/github/gitignore/218a941be92679ce67d0484547e3e142b2f5f6f0/Swift.gitignore
32-
33-
# Xcode
34-
#
35-
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
36-
37-
## User settings
38-
xcuserdata/
39-
40-
## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
41-
*.xcscmblueprint
42-
*.xccheckout
43-
44-
## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
45-
build/
1+
Packages
2+
.build
3+
xcuserdata
4+
*.xcodeproj
465
DerivedData/
47-
*.moved-aside
48-
*.pbxuser
49-
!default.pbxuser
50-
*.mode1v3
51-
!default.mode1v3
52-
*.mode2v3
53-
!default.mode2v3
54-
*.perspectivev3
55-
!default.perspectivev3
56-
57-
## Obj-C/Swift specific
58-
*.hmap
59-
60-
## App packaging
61-
*.ipa
62-
*.dSYM.zip
63-
*.dSYM
64-
65-
## Playgrounds
66-
timeline.xctimeline
67-
playground.xcworkspace
68-
69-
# Swift Package Manager
70-
#
71-
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
72-
# Packages/
73-
# Package.pins
74-
# Package.resolved
75-
# *.xcodeproj
76-
#
77-
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
78-
# hence it is not needed unless you have added a package configuration file to your project
79-
# .swiftpm
80-
81-
.build/
82-
83-
# CocoaPods
84-
#
85-
# We recommend against adding the Pods directory to your .gitignore. However
86-
# you should judge for yourself, the pros and cons are mentioned at:
87-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
88-
#
89-
# Pods/
90-
#
91-
# Add this line if you want to avoid checking in source code from the Xcode workspace
92-
# *.xcworkspace
93-
94-
# Carthage
95-
#
96-
# Add this line if you want to avoid checking in source code from Carthage dependencies.
97-
# Carthage/Checkouts
98-
99-
Carthage/Build/
100-
101-
# Accio dependency management
102-
Dependencies/
103-
.accio/
104-
105-
# fastlane
106-
#
107-
# It is recommended to not store the screenshots in the git repo.
108-
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
109-
# For more information about the recommended setup visit:
110-
# https://docs.fastlane.tools/best-practices/source-control/#source-control
111-
112-
fastlane/report.xml
113-
fastlane/Preview.html
114-
fastlane/screenshots/**/*.png
115-
fastlane/test_output
116-
117-
# Code Injection
118-
#
119-
# After new code Injection tools there's a generated folder /iOSInjectionProject
120-
# https://github.com/johnno1962/injectionforxcode
121-
122-
iOSInjectionProject/
123-
6+
.DS_Store
7+
db.sqlite
8+
.swiftpm
1249

.swiftpm/xcode/xcshareddata/xcschemes/swift-ast-explorer.xcscheme

+29-21
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
buildForAnalyzing = "YES">
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
17-
BlueprintIdentifier = "swift-ast-explorer"
18-
BuildableName = "swift-ast-explorer"
19-
BlueprintName = "swift-ast-explorer"
17+
BlueprintIdentifier = "Run"
18+
BuildableName = "Run"
19+
BlueprintName = "Run"
2020
ReferencedContainer = "container:">
2121
</BuildableReference>
2222
</BuildActionEntry>
@@ -28,9 +28,23 @@
2828
buildForAnalyzing = "YES">
2929
<BuildableReference
3030
BuildableIdentifier = "primary"
31-
BlueprintIdentifier = "swift-ast-explorerTests"
32-
BuildableName = "swift-ast-explorerTests"
33-
BlueprintName = "swift-ast-explorerTests"
31+
BlueprintIdentifier = "AppTests"
32+
BuildableName = "AppTests"
33+
BlueprintName = "AppTests"
34+
ReferencedContainer = "container:">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
<BuildActionEntry
38+
buildForTesting = "YES"
39+
buildForRunning = "YES"
40+
buildForProfiling = "YES"
41+
buildForArchiving = "YES"
42+
buildForAnalyzing = "YES">
43+
<BuildableReference
44+
BuildableIdentifier = "primary"
45+
BlueprintIdentifier = "App"
46+
BuildableName = "App"
47+
BlueprintName = "App"
3448
ReferencedContainer = "container:">
3549
</BuildableReference>
3650
</BuildActionEntry>
@@ -46,9 +60,9 @@
4660
skipped = "NO">
4761
<BuildableReference
4862
BuildableIdentifier = "primary"
49-
BlueprintIdentifier = "swift-ast-explorerTests"
50-
BuildableName = "swift-ast-explorerTests"
51-
BlueprintName = "swift-ast-explorerTests"
63+
BlueprintIdentifier = "AppTests"
64+
BuildableName = "AppTests"
65+
BlueprintName = "AppTests"
5266
ReferencedContainer = "container:">
5367
</BuildableReference>
5468
</TestableReference>
@@ -68,18 +82,12 @@
6882
runnableDebuggingMode = "0">
6983
<BuildableReference
7084
BuildableIdentifier = "primary"
71-
BlueprintIdentifier = "swift-ast-explorer"
72-
BuildableName = "swift-ast-explorer"
73-
BlueprintName = "swift-ast-explorer"
85+
BlueprintIdentifier = "Run"
86+
BuildableName = "Run"
87+
BlueprintName = "Run"
7488
ReferencedContainer = "container:">
7589
</BuildableReference>
7690
</BuildableProductRunnable>
77-
<CommandLineArguments>
78-
<CommandLineArgument
79-
argument = "/Users/katsumi.kishikawa/Desktop/test.swift"
80-
isEnabled = "YES">
81-
</CommandLineArgument>
82-
</CommandLineArguments>
8391
</LaunchAction>
8492
<ProfileAction
8593
buildConfiguration = "Release"
@@ -91,9 +99,9 @@
9199
runnableDebuggingMode = "0">
92100
<BuildableReference
93101
BuildableIdentifier = "primary"
94-
BlueprintIdentifier = "swift-ast-explorer"
95-
BuildableName = "swift-ast-explorer"
96-
BlueprintName = "swift-ast-explorer"
102+
BlueprintIdentifier = "Run"
103+
BuildableName = "Run"
104+
BlueprintName = "Run"
97105
ReferencedContainer = "container:">
98106
</BuildableReference>
99107
</BuildableProductRunnable>

Dockerfile

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# ================================
2+
# Build image
3+
# ================================
4+
FROM swift:5.3-focal as build
5+
6+
# Install OS updates and, if needed, sqlite3
7+
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
8+
&& apt-get -q update \
9+
&& apt-get -q dist-upgrade -y \
10+
&& rm -rf /var/lib/apt/lists/*
11+
12+
# Set up a build area
13+
WORKDIR /build
14+
15+
# First just resolve dependencies.
16+
# This creates a cached layer that can be reused
17+
# as long as your Package.swift/Package.resolved
18+
# files do not change.
19+
COPY ./Package.* ./
20+
RUN swift package resolve
21+
22+
# Copy entire repo into container
23+
COPY . .
24+
25+
# Build everything, with optimizations and test discovery
26+
RUN swift build --enable-test-discovery -c release
27+
28+
# Switch to the staging area
29+
WORKDIR /staging
30+
31+
# Copy main executable to staging area
32+
RUN cp "$(swift build --package-path /build -c release --show-bin-path)/Run" ./
33+
34+
# Uncomment the next line if you need to load resources from the `Public` directory.
35+
# Ensure that by default, neither the directory nor any of its contents are writable.
36+
#RUN mv /build/Public ./Public && chmod -R a-w ./Public
37+
38+
# ================================
39+
# Run image
40+
# ================================
41+
FROM swift:5.3-focal-slim
42+
43+
# Make sure all system packages are up to date.
44+
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true && \
45+
apt-get -q update && apt-get -q dist-upgrade -y && rm -r /var/lib/apt/lists/*
46+
47+
# Create a vapor user and group with /app as its home directory
48+
RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor
49+
50+
# Switch to the new home directory
51+
WORKDIR /app
52+
53+
# Copy built executable and any staged resources from builder
54+
COPY --from=build --chown=vapor:vapor /staging /app
55+
56+
# Ensure all further commands run as the vapor user
57+
USER vapor:vapor
58+
59+
# Let Docker bind to port 8080
60+
EXPOSE 8080
61+
62+
# Start the Vapor service when the image is run, default to listening on 8080 in production environment
63+
ENTRYPOINT ["./Run"]
64+
CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"]

0 commit comments

Comments
 (0)