Skip to content

Commit d7f388f

Browse files
committed
Update docker setup andd add proper Readme.
1 parent 0a76668 commit d7f388f

18 files changed

+265
-58
lines changed

.dockerignore

-4
This file was deleted.

Dockerfile.alpine

-16
This file was deleted.

Makefile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.PHONY: server
2+
server:
3+
docker-compose run --rm --service-ports mint start --host 0.0.0.0
4+
5+
.PHONY: build
6+
build:
7+
docker-compose run --rm mint build
8+
9+
.PHONY: format
10+
format:
11+
docker-compose run --rm mint format
12+
13+
.PHONY: install
14+
install:
15+
docker-compose run --rm mint install

Readme.md

+117-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,123 @@
11
# Mint in Docker
22

3-
This is a starting repository if you want to run Mint in a docker container.
3+
This repository offers a starting point of running mint in Docker. It uses [Docker Compose](https://docs.docker.com/compose/) so you should have it installed.
44

5-
To start the development server just clone the repository and run:
5+
The default scaffolded application is located in the `workspace` folder and it's used as a starting point.
66

7+
If you only want to use Docker check the end of this readme.
8+
9+
## Avaiable Commands
10+
11+
This repository makes use of a [Makefile](https://en.wikipedia.org/wiki/Make_(software)#Makefile) to achieve short commands.
12+
13+
### Development Server
14+
15+
Run `make` or `make server` to start a development server:
16+
17+
```console
18+
$ make
19+
docker-compose run --rm --service-ports mint start --host 0.0.0.0
20+
Mint - Running the development server
21+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
22+
⚙ Ensuring dependencies... 130μs
23+
⚙ Parsing files... 20.682ms
24+
⚙ Development server started on http://0.0.0.0:3000/
25+
```
26+
27+
### Build
28+
29+
Run `make build` to build the final files into the `workspace/dist` folder:
30+
31+
```console
32+
$ make build
33+
docker-compose run --rm mint build
34+
Mint - Building for production
35+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
36+
⚙ Ensuring dependencies... 0μs
37+
⚙ Clearing the "dist" directory... 376μs
38+
⚙ Compiling your application:
39+
➔ Parsing 4 source files... 17.345ms
40+
➔ Type checking: 22.129ms
41+
➔ Compiling: 2.541ms
42+
⚙ Writing external stylesheets...165μs
43+
⚙ Writing index.html... 587μs
44+
⚙ Writing manifest.webmanifest...140μs
45+
⚙ Generating icons... 363.919ms
46+
⚙ Creating service worker...1.079ms
47+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
48+
All done in 2.274s!
49+
```
50+
51+
### Formatting Files
52+
53+
Run `make format` to format all source files:
54+
55+
```console
56+
$ make format
57+
docker-compose run --rm mint format
58+
Mint - Formatting files
59+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
60+
All files are formatted!
61+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
62+
All done in 41.795ms!
63+
```
64+
65+
### Install Dependencies
66+
67+
Run `make install` to install any dependencies you added:
68+
69+
```console
70+
$ make install
71+
docker-compose run --rm mint install
72+
Mint - Installing dependencies
73+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
74+
There are no dependencies!
75+
76+
There is nothing to do!
77+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
78+
All done in 119μs!
779
```
8-
docker-compose up
80+
81+
## Plain Docker
82+
83+
You can use plain Docker to achieve the same commands above.
84+
85+
You will need to pull the latest image:
86+
87+
```console
88+
$ docker pull mintlang/mint
89+
```
90+
91+
If you are on windows you need to change `$(pwd)/workspace` to the absolute path of the `workspace` folder.
92+
93+
### Development Server
94+
95+
To run the development server run the following command:
96+
97+
```console
98+
docker run --tty -v $(pwd)/workspace:/workspace -w /workspace -p 3000:3000 --rm -ti mint start -h 0.0.0.0
99+
```
100+
101+
### Build
102+
103+
To create a build run:
104+
105+
```console
106+
docker run --tty -v $(pwd)/workspace:/workspace -w /workspace --rm -ti mint build
107+
```
108+
109+
### Formatting Files
110+
111+
To format files run:
112+
113+
```console
114+
docker run --tty -v $(pwd)/workspace:/workspace -w /workspace --rm -ti mint format
115+
```
116+
117+
### Install Dependencies
118+
119+
To install dependencies run:
120+
121+
```console
122+
docker run --tty -v $(pwd)/workspace:/workspace -w /workspace --rm -ti mint install
9123
```

bin/build-image

-6
This file was deleted.

bin/entrypoint

-6
This file was deleted.

docker-compose.yml

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
version: "2.4"
22
services:
33
mint:
4-
image: mint
5-
build:
6-
context: ./
7-
dockerfile: Dockerfile.alpine
4+
image: mintlang/mint:0.12.0
5+
working_dir: /opt/mint
86
volumes:
97
- ./workspace:/opt/mint
10-
working_dir: /opt/mint
11-
command: start --host 0.0.0.0
128
ports:
139
- 3000:3000

workspace/.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
.mint
2-
dist
1+
dist

workspace/assets/favicon.png

10.9 KB
Loading

workspace/assets/head.html

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<!-- Put HTML tags here for loading JavaScript or CSS files. -->
2+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,600,700|Source+Code+Pro:400,600|M+PLUS+Rounded+1c:500,700&display=swap">

workspace/assets/style.css

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
margin: 0;
3+
}

workspace/mint.json

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"name": "workspace",
3+
"application": {
4+
"head": "assets/head.html",
5+
"title": "workspace",
6+
"icon": "assets/favicon.png"
7+
},
8+
"external": {
9+
"stylesheets": [
10+
"assets/style.css"
11+
]
12+
},
313
"source-directories": [
414
"source"
515
],

workspace/source/Info.mint

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
component Info {
2+
property mainPath : String
3+
4+
style info {
5+
font-size: calc(10px + 2vmin);
6+
color: #939DB0;
7+
}
8+
9+
style path {
10+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
11+
font-style: italic;
12+
font-weight: 100;
13+
color: #E06C75;
14+
}
15+
16+
fun render : Html {
17+
<p::info>
18+
<{ "Edit " }>
19+
20+
<code::path>
21+
<{ mainPath }>
22+
</code>
23+
24+
<{ " and save to reload." }>
25+
</p>
26+
}
27+
}

workspace/source/Link.mint

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
component Link {
2+
property children : Array(Html) = []
3+
property href : String
4+
5+
style link {
6+
font-size: calc(10px + 2vmin);
7+
text-decoration: none;
8+
color: #DDDDDD;
9+
10+
&:hover {
11+
text-decoration: underline;
12+
}
13+
}
14+
15+
fun render : Html {
16+
<a::link
17+
href="#{href}"
18+
target="_blank">
19+
20+
<{ children }>
21+
22+
</a>
23+
}
24+
}

workspace/source/Logo.mint

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
component Logo {
2+
style logo {
3+
svg {
4+
animation: shake 2s infinite ease-in-out;
5+
animation-delay: 1s;
6+
}
7+
8+
@keyframes shake {
9+
0% {
10+
transform: translate(1px, 1px) rotate(0deg);
11+
}
12+
13+
3% {
14+
transform: translate(-1px, -2px) rotate(-1deg);
15+
}
16+
17+
6% {
18+
transform: translate(-3px, 0px) rotate(1deg);
19+
}
20+
21+
9% {
22+
transform: translate(3px, 2px) rotate(0deg);
23+
}
24+
25+
12% {
26+
transform: translate(1px, -1px) rotate(1deg);
27+
}
28+
29+
15% {
30+
transform: translate(0px, 0px) rotate(-1deg);
31+
}
32+
}
33+
}
34+
35+
fun render : Html {
36+
<div::logo>
37+
<{ @svg(logo.svg) }>
38+
</div>
39+
}
40+
}

workspace/source/Main.mint

+15-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,27 @@
11
component Main {
2-
style base {
3-
font-family: sans;
4-
font-weight: bold;
5-
font-size: 50px;
6-
2+
style app {
73
justify-content: center;
4+
flex-direction: column;
85
align-items: center;
96
display: flex;
7+
8+
background-color: #282C34;
109
height: 100vh;
1110
width: 100vw;
11+
12+
font-family: Open Sans;
13+
font-weight: bold;
1214
}
1315

1416
fun render : Html {
15-
<div::base>
16-
<{ "Hello Mint!" }>
17+
<div::app>
18+
<Logo/>
19+
20+
<Info mainPath="source/Main.mint"/>
21+
22+
<Link href="https://www.mint-lang.com/">
23+
"Learn Mint"
24+
</Link>
1725
</div>
1826
}
1927
}

workspace/source/logo.svg

+1
Loading

workspace/tests/Main.mint

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
suite "Main" {
2-
test "Greets Mint" {
3-
with Test.Html {
4-
<Main/>
5-
|> start()
6-
|> assertTextOf("div", "Hello Mint!")
7-
}
1+
suite "Main" {
2+
test "Greets Mint" {
3+
with Test.Html {
4+
<Main/>
5+
|> start()
6+
|> assertTextOf("a", "Learn Mint")
87
}
9-
}
8+
}
9+
}

0 commit comments

Comments
 (0)