Skip to content

Commit b3602b0

Browse files
authored
Add Docker support (#2)
2 parents 76e55b9 + 289bb41 commit b3602b0

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

Dockerfile

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Multi-stage
2+
# 1) Node image for building frontend assets
3+
# 2) nginx stage to serve frontend assets
4+
# Name the node stage "builder"
5+
FROM node:16.3.0-alpine AS builder
6+
# Set working directory
7+
WORKDIR /app
8+
# Copy all files from current directory to working dir in image
9+
COPY . .
10+
# install node modules and build assets
11+
RUN npm install && npm run build
12+
13+
# nginx state for serving content
14+
FROM nginx:alpine
15+
# Set working directory to nginx asset directory
16+
WORKDIR /usr/share/nginx/html
17+
# Remove default nginx static assets
18+
RUN rm -rf ./*
19+
# Copy static assets from builder stage
20+
COPY --from=builder /app/dist .
21+
# Containers run nginx with global directives and daemon off
22+
ENTRYPOINT ["nginx", "-g", "daemon off;"]

README.md

+15
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ This will call the script in [`emscr/builds/openssl/build.sh`](https://github.co
5151

5252
The created files `openssl.wasm` and `openssl.js` are then copied into `emscr/binary`, where the webpack server will deliver them from.
5353

54+
## Docker Integration
55+
56+
The source code contains `Dockerfile` which allows you to create a [`docker`](https://www.docker.com/) image. To create a new one use the following command. Note that built app inside the image will be hosted on the [`nginx`](https://github.com/nginx/nginx) http server.
57+
58+
```shell
59+
$ docker build -t openssl-wt .
60+
```
61+
62+
For create a docker container use the:
63+
64+
```shell
65+
$ docker run --rm -it -p 10080:80 -d openssl-wt
66+
```
67+
68+
After that you can view the OpenSSL Webterm at http://localhost:10080
5469

5570
## Contributing
5671

0 commit comments

Comments
 (0)