Skip to content

Instantly share code, notes, and snippets.

@pjmeca
Last active May 1, 2024 15:55
Show Gist options
  • Save pjmeca/27e97435d2925de07aeabc0e152f99b6 to your computer and use it in GitHub Desktop.
Save pjmeca/27e97435d2925de07aeabc0e152f99b6 to your computer and use it in GitHub Desktop.
Dockerfile for building a custom image of squoosh.app
FROM alpine/git AS git
RUN mkdir /app
WORKDIR /app
RUN git clone https://github.com/GoogleChromeLabs/squoosh.git .
FROM node:14-alpine AS builder
WORKDIR /app
COPY --from=git /app/package*.json ./
RUN npm install
COPY --from=git /app .
RUN npm run build
FROM nginx:alpine
LABEL org.label-schema.name="pjmeca/squoosh" \
org.label-schema.description="Custom image for running squoosh.app locally." \
org.label-schema.url="https://hub.docker.com/r/pjmeca/squoosh" \
org.label-schema.vcs-url="https://gist.github.com/pjmeca/27e97435d2925de07aeabc0e152f99b6" \
org.label-schema.version="1.0.0" \
org.label-schema.schema-version="1.0.0-rc.1" \
org.label-schema.docker.cmd="docker run -d -p 80:80 pjmeca/squoosh" \
maintainer="pjmeca"
WORKDIR /usr/share/nginx/html
COPY --from=builder /app/build .
RUN rm -rf ./sw.js
CMD ["nginx", "-g", "daemon off;"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment