-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a Dockerfile for building docker images (#101)
- Loading branch information
1 parent
ee3eb85
commit 14c0f13
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
FROM node:21.6.1 AS build | ||
|
||
# Create a directory for the build and populate it with repo | ||
COPY ./ /opt/curl-build/ | ||
|
||
WORKDIR /opt | ||
|
||
# Install the prerequisites for the project | ||
RUN echo "## Update and install packages" && \ | ||
apt-get -qq -y update && \ | ||
apt-get -qq install -y --no-install-recommends \ | ||
binutils \ | ||
build-essential \ | ||
ca-certificates \ | ||
file \ | ||
git \ | ||
python3 \ | ||
python3-pip && \ | ||
echo "## Done" | ||
|
||
# Install EMSDK | ||
RUN echo "## Build and install EMSDK" && \ | ||
git clone https://github.com/emscripten-core/emsdk.git && \ | ||
cd emsdk && \ | ||
bash emsdk install latest && \ | ||
bash emsdk activate latest && \ | ||
echo "## Done" | ||
|
||
# Build curlconverter.github.io distribution | ||
RUN echo "## Build curlconverter.gitub.io" && \ | ||
cd /opt/emsdk && \ | ||
. /opt/emsdk/emsdk_env.sh && \ | ||
cd /opt/curl-build && \ | ||
npm install && \ | ||
npm run build && \ | ||
echo "## Done" | ||
|
||
|
||
# Create a new image from the build containing just the web content | ||
FROM nginx:latest | ||
COPY --from=build /opt/curl-build/dist /usr/share/nginx/html | ||
|
||
|
||
LABEL maintainer="contact@lemonlemmings.co.uk" \ | ||
org.label-schema.name="curlconverter.github.io" \ | ||
org.label-schema.description="A container containing the curlconverter.github.io demonstration web app" \ | ||
org.label-schema.url="https://curlconverter.com" \ | ||
org.label-schema.vcs-url="https://github.com/curlconverter/curlconverter.github.io" \ | ||
org.label-schema.docker.dockerfile="/docker/Dockerfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
To run build locally from the root of the repository run: | ||
|
||
```bash | ||
docker build -f ./docker/Dockerfile -t curlconverter.github.io-nginx . | ||
``` |