Skip to content

Commit 5c32dbc

Browse files
author
Huy (Henry) Tran
committed
🐳 Add Dockerfile and image build script
1 parent d157c55 commit 5c32dbc

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,29 @@ Now, go to [http://localhost:8080](http://localhost:8080) to test, the response
2222

2323
---
2424

25-
# Setting up Docker container for Swift
25+
# Setting up Docker container from Dockerfile
26+
27+
Go to `docker` folder and run `build.sh` to build `swiftbox` image
28+
29+
```
30+
cd docker
31+
./build.sh
32+
```
33+
34+
Run new container from `swiftbox` image, mount your working directory and expose the port:
35+
36+
```
37+
docker run -it -p 8080:8080 -v /path/to/your/host/working/folder:/src swiftbox
38+
```
39+
40+
Now you can go to `/src` folder, which linked to your `/path/to/your/host/working/folder` to start using:
41+
42+
```
43+
cd /src
44+
swift build
45+
```
46+
47+
# Setting up Docker container for Swift yourself
2648

2749
Create new `ubuntu` container, don't forget to expose port `8080` or whatever you want, to test the HTTP server
2850

@@ -65,3 +87,7 @@ Now, you have Swift installed, test it with the following command:
6587
```
6688
swift --version
6789
```
90+
91+
# License
92+
93+
The source code is published under MIT license. Please see `LICENSE.md` for more detail.

docker/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ubuntu:latest
2+
EXPOSE 8080
3+
RUN echo "Installing dependencies..."
4+
RUN apt-get update && apt-get install -y --force-yes wget build-essential clang rsync libpython-all-dev libedit-dev libicu52
5+
RUN cd /
6+
RUN wget https://swift.org/builds/ubuntu1404/swift-2.2-SNAPSHOT-2015-12-01-b/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
7+
RUN tar xzf swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
8+
RUN rsync -a -v swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/ /usr
9+
RUN rm -rf swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04*

docker/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker build -t swiftbox .

0 commit comments

Comments
 (0)