Skip to content

Commit

Permalink
Merge branch 'feature/docker'
Browse files Browse the repository at this point in the history
  • Loading branch information
Thadah committed Nov 23, 2024
2 parents 4263d09 + 90f16ec commit 2ee2ed8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM rust:1.82-slim as builder

RUN apt-get update && \
apt-get install -y --no-install-recommends \
pkg-config \
libssl-dev \
build-essential \
curl \
tar \
&& rm -rf /var/lib/apt/lists/*

# Since the Binaryen in Debian is old, we need to install it from source
ENV BINARYEN_VERSION=120_b
ENV BINARYEN_URL=https://github.com/WebAssembly/binaryen/releases/download/version_${BINARYEN_VERSION}/binaryen-version_${BINARYEN_VERSION}-x86_64-linux.tar.gz

RUN curl -L -o binaryen.tar.gz ${BINARYEN_URL} && \
tar -xzf binaryen.tar.gz && \
mv binaryen-version_${BINARYEN_VERSION} /opt/binaryen && \
ln -s /opt/binaryen/bin/wasm-opt /usr/local/bin/wasm-opt && \
rm binaryen.tar.gz

RUN rustup target add wasm32-unknown-unknown

RUN cargo install --locked trunk

WORKDIR /app

COPY Cargo.toml Cargo.lock ./

COPY index.html ./
COPY index.scss ./
COPY src ./src
COPY images ./images

RUN trunk build --release --dist=dist

FROM nginx:alpine

RUN rm -rf /usr/share/nginx/html/*

COPY --from=builder /app/dist /usr/share/nginx/html

EXPOSE 80

# Start Nginx
CMD ["nginx", "-g", "daemon off;"]
15 changes: 15 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
v_vmifier:
container_name: v_vmifier
build:
context: .
dockerfile: Dockerfile
image: v_vmifier:latest
ports:
- "80:80"
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 30s
timeout: 10s
retries: 3

0 comments on commit 2ee2ed8

Please sign in to comment.