Skip to content

Commit 14c0f13

Browse files
Added a Dockerfile for building docker images (#101)
1 parent ee3eb85 commit 14c0f13

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-0
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
dist
2+
node_modules

docker/Dockerfile

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM node:21.6.1 AS build
2+
3+
# Create a directory for the build and populate it with repo
4+
COPY ./ /opt/curl-build/
5+
6+
WORKDIR /opt
7+
8+
# Install the prerequisites for the project
9+
RUN echo "## Update and install packages" && \
10+
apt-get -qq -y update && \
11+
apt-get -qq install -y --no-install-recommends \
12+
binutils \
13+
build-essential \
14+
ca-certificates \
15+
file \
16+
git \
17+
python3 \
18+
python3-pip && \
19+
echo "## Done"
20+
21+
# Install EMSDK
22+
RUN echo "## Build and install EMSDK" && \
23+
git clone https://github.com/emscripten-core/emsdk.git && \
24+
cd emsdk && \
25+
bash emsdk install latest && \
26+
bash emsdk activate latest && \
27+
echo "## Done"
28+
29+
# Build curlconverter.github.io distribution
30+
RUN echo "## Build curlconverter.gitub.io" && \
31+
cd /opt/emsdk && \
32+
. /opt/emsdk/emsdk_env.sh && \
33+
cd /opt/curl-build && \
34+
npm install && \
35+
npm run build && \
36+
echo "## Done"
37+
38+
39+
# Create a new image from the build containing just the web content
40+
FROM nginx:latest
41+
COPY --from=build /opt/curl-build/dist /usr/share/nginx/html
42+
43+
44+
LABEL maintainer="[email protected]" \
45+
org.label-schema.name="curlconverter.github.io" \
46+
org.label-schema.description="A container containing the curlconverter.github.io demonstration web app" \
47+
org.label-schema.url="https://curlconverter.com" \
48+
org.label-schema.vcs-url="https://github.com/curlconverter/curlconverter.github.io" \
49+
org.label-schema.docker.dockerfile="/docker/Dockerfile"

docker/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
To run build locally from the root of the repository run:
2+
3+
```bash
4+
docker build -f ./docker/Dockerfile -t curlconverter.github.io-nginx .
5+
```

0 commit comments

Comments
 (0)