Skip to content

Commit

Permalink
Added a Dockerfile for building docker images (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemonlemmings authored Feb 2, 2024
1 parent ee3eb85 commit 14c0f13
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
49 changes: 49 additions & 0 deletions docker/Dockerfile
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"
5 changes: 5 additions & 0 deletions docker/README.md
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 .
```

0 comments on commit 14c0f13

Please # to comment.