Skip to content

Commit 27dfdb7

Browse files
committed
Restructured to support multiple tags
1 parent 7cb0ebf commit 27dfdb7

File tree

15 files changed

+115
-90
lines changed

15 files changed

+115
-90
lines changed

README.md

Lines changed: 9 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,25 @@
1+
# Daeploy Builder Images
12

2-
# Creating a basic S2I builder image
3+
This repository contains s2i builder images designed for Daeploy.
34

4-
## Getting started
5-
6-
### Files and Directories
7-
8-
| File | Required? | Description |
9-
|------------------------|-----------|--------------------------------------------------------------|
10-
| Dockerfile | Yes | Defines the base builder image |
11-
| s2i/bin/assemble | Yes | Script that builds the application |
12-
| s2i/bin/usage | No | Script that prints the usage of the builder |
13-
| s2i/bin/run | Yes | Script that runs the application |
14-
| s2i/bin/save-artifacts | No | Script for incremental builds that saves the built artifacts |
15-
| test/run | No | Test script for the builder image |
16-
| test/test-app | Yes | Test application source code |
17-
18-
#### Dockerfile
19-
20-
Create a *Dockerfile* that installs all of the necessary tools and libraries that are needed to build and run our application. This file will also handle copying the s2i scripts into the created image.
21-
22-
#### S2I scripts
23-
24-
##### assemble
25-
26-
Create an *assemble* script that will build our application, e.g.:
27-
28-
- build python modules
29-
- bundle install ruby gems
30-
- setup application specific configuration
31-
32-
The script can also specify a way to restore any saved artifacts from the previous image.
33-
34-
##### run
35-
36-
Create a *run* script that will start the application.
37-
38-
##### save-artifacts (optional)
39-
40-
Create a *save-artifacts* script which allows a new build to reuse content from a previous version of the application image.
41-
42-
##### usage (optional)
43-
44-
Create a *usage* script that will print out instructions on how to use the image.
45-
46-
##### Make the scripts executable
47-
48-
Make sure that all of the scripts are executable by running *chmod +x s2i/bin/**
49-
50-
#### Create the builder image
51-
52-
The following command will create a builder image named daeploy/s2i-python based on the Dockerfile that was created previously.
5+
## Creating the image
536

547
```bash
55-
docker build -t daeploy/s2i-python .
8+
docker build -t daeploy/s2i-python:tag ./path/to/image/dir
569
```
5710

58-
The builder image can also be created by using the *make* command since a *Makefile* is included.
59-
60-
Once the image has finished building, the command *s2i usage daeploy/s2i-python* will print out the help info that was defined in the *usage* script.
61-
62-
#### Testing the builder image
63-
64-
The builder image can be tested using the following commands:
65-
66-
```bash
67-
docker build -t daeploy/s2i-python-candidate .
68-
IMAGE_NAME=daeploy/s2i-python-candidate test/run
69-
```
70-
71-
The builder image can also be tested by using the *make test* command since a *Makefile* is included.
72-
73-
#### Creating the application image
11+
## Using the image
7412

75-
The application image combines the builder image with your applications source code, which is served using whatever application is installed via the *Dockerfile*, compiled using the *assemble* script, and run using the *run* script.
76-
The following command will create the application image:
13+
Use the builder image to create an application from source code or a git repo
7714

7815
```bash
79-
s2i build test/test-app daeploy/s2i-python daeploy/s2i-python-app
16+
$ s2i build test/test-app daeploy/s2i-python s2i-python-app
8017
---> Building and installing application from source...
8118
```
8219

83-
Using the logic defined in the *assemble* script, s2i will now create an application image using the builder image as a base and including the source code from the test/test-app directory.
84-
85-
#### Running the application image
86-
87-
Running the application image is as simple as invoking the docker run command:
20+
Deploy the application
8821

8922
```bash
90-
docker run -d -p 8080:8080 daeploy/s2i-python-app
91-
```
92-
93-
The application, which consists of a simple static web page, should now be accessible at [http://localhost:8080](http://localhost:8080).
94-
95-
#### Using the saved artifacts script
96-
97-
Rebuilding the application using the saved artifacts can be accomplished using the following command:
98-
99-
```bash
100-
s2i build --incremental=true test/test-app nginx-centos7 nginx-app
101-
---> Restoring build artifacts...
23+
$ daeploy deploy name version -i s2i-python-app
10224
---> Building and installing application from source...
10325
```
104-
105-
This will run the *save-artifacts* script which includes the custom code to backup the currently running application source, rebuild the application image, and then re-deploy the previously saved source using the *assemble* script.

Dockerfile renamed to python38-slim/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LABEL maintainer="Viking Analytics AB"
66
ENV BUILDER_VERSION 1.0
77

88
# Set labels used in OpenShift to describe the builder image
9-
LABEL io.k8s.description="Platform for building daeploy images with reduced size" \
9+
LABEL io.k8s.description="Platform for building Daeploy images with reduced size" \
1010
io.k8s.display-name="Daeploy python builder" \
1111
io.openshift.expose-services="8080:http" \
1212
io.openshift.tags="builder,daeploy,python." \
File renamed without changes.

python38-slim/README.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
2+
# Creating a basic S2I builder image
3+
4+
## Getting started
5+
6+
### Files and Directories
7+
8+
| File | Required? | Description |
9+
|------------------------|-----------|--------------------------------------------------------------|
10+
| Dockerfile | Yes | Defines the base builder image |
11+
| s2i/bin/assemble | Yes | Script that builds the application |
12+
| s2i/bin/usage | No | Script that prints the usage of the builder |
13+
| s2i/bin/run | Yes | Script that runs the application |
14+
| s2i/bin/save-artifacts | No | Script for incremental builds that saves the built artifacts |
15+
| test/run | No | Test script for the builder image |
16+
| test/test-app | Yes | Test application source code |
17+
18+
#### Dockerfile
19+
20+
Create a *Dockerfile* that installs all of the necessary tools and libraries that are needed to build and run our application. This file will also handle copying the s2i scripts into the created image.
21+
22+
#### S2I scripts
23+
24+
##### assemble
25+
26+
Create an *assemble* script that will build our application, e.g.:
27+
28+
- build python modules
29+
- bundle install ruby gems
30+
- setup application specific configuration
31+
32+
The script can also specify a way to restore any saved artifacts from the previous image.
33+
34+
##### run
35+
36+
Create a *run* script that will start the application.
37+
38+
##### save-artifacts (optional)
39+
40+
Create a *save-artifacts* script which allows a new build to reuse content from a previous version of the application image.
41+
42+
##### usage (optional)
43+
44+
Create a *usage* script that will print out instructions on how to use the image.
45+
46+
##### Make the scripts executable
47+
48+
Make sure that all of the scripts are executable by running *chmod +x s2i/bin/**
49+
50+
#### Create the builder image
51+
52+
The following command will create a builder image named daeploy/s2i-python based on the Dockerfile that was created previously.
53+
54+
```bash
55+
docker build -t daeploy/s2i-python .
56+
```
57+
58+
The builder image can also be created by using the *make* command since a *Makefile* is included.
59+
60+
Once the image has finished building, the command *s2i usage daeploy/s2i-python* will print out the help info that was defined in the *usage* script.
61+
62+
#### Testing the builder image
63+
64+
The builder image can be tested using the following commands:
65+
66+
```bash
67+
docker build -t daeploy/s2i-python-candidate .
68+
IMAGE_NAME=daeploy/s2i-python-candidate test/run
69+
```
70+
71+
The builder image can also be tested by using the *make test* command since a *Makefile* is included.
72+
73+
#### Creating the application image
74+
75+
The application image combines the builder image with your applications source code, which is served using whatever application is installed via the *Dockerfile*, compiled using the *assemble* script, and run using the *run* script.
76+
The following command will create the application image:
77+
78+
```bash
79+
s2i build test/test-app daeploy/s2i-python daeploy/s2i-python-app
80+
---> Building and installing application from source...
81+
```
82+
83+
Using the logic defined in the *assemble* script, s2i will now create an application image using the builder image as a base and including the source code from the test/test-app directory.
84+
85+
#### Running the application image
86+
87+
Running the application image is as simple as invoking the docker run command:
88+
89+
```bash
90+
docker run -d -p 8080:8080 daeploy/s2i-python-app
91+
```
92+
93+
The application, which consists of a simple static web page, should now be accessible at [http://localhost:8080](http://localhost:8080).
94+
95+
#### Using the saved artifacts script
96+
97+
Rebuilding the application using the saved artifacts can be accomplished using the following command:
98+
99+
```bash
100+
s2i build --incremental=true test/test-app nginx-centos7 nginx-app
101+
---> Restoring build artifacts...
102+
---> Building and installing application from source...
103+
```
104+
105+
This will run the *save-artifacts* script which includes the custom code to backup the currently running application source, rebuild the application image, and then re-deploy the previously saved source using the *assemble* script.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)