Switch to Nginx for less size and ram usage

pull/4/head
Quentin McGaw 6 years ago
parent 7f8d4c2b1a
commit 83d07005fe

@ -1,3 +0,0 @@
*:80 {
root /stackedit
}

@ -1,13 +1,3 @@
FROM golang:alpine AS caddy
WORKDIR /go/src/github.com/mholt/caddy
RUN echo https://alpine.global.ssl.fastly.net/alpine/v3.8/main > /etc/apk/repositories && \
apk add --progress --update git gcc musl-dev ca-certificates
RUN git clone --branch v0.11.0 --single-branch --depth 1 https://github.com/mholt/caddy /go/src/github.com/mholt/caddy &> /dev/null && \
sed -i 's/var EnableTelemetry = true/var EnableTelemetry = false/' /go/src/github.com/mholt/caddy/caddy/caddymain/run.go && \
sed -i 's/const enableTelemetry = true/const enableTelemetry = false/' /go/src/github.com/mholt/caddy/caddy/caddymain/run.go
RUN git clone https://github.com/caddyserver/builds /go/src/github.com/caddyserver/builds
RUN cd caddy && go run build.go -goos=linux -goarch=amd64
FROM alpine:3.8 AS stackedit
RUN echo https://alpine.global.ssl.fastly.net/alpine/v3.8/main > /etc/apk/repositories && \
apk add -q --progress --update --no-cache git npm
@ -16,16 +6,13 @@ WORKDIR /stackedit
RUN npm install
RUN npm run build
FROM alpine:3.8
FROM nginx:1.15-alpine
LABEL maintainer="quentin.mcgaw@gmail.com" \
description="StackEdit server in a lightweight Docker container" \
download="???MB" \
size="51.2MB" \
ram="2MB-3MB" \
size="45.5MB" \
ram="7MB" \
cpu_usage="Very low" \
github="https://github.com/qdm12/stackedit-docker"
EXPOSE 80
COPY --from=stackedit /stackedit/dist /stackedit
COPY --from=caddy /go/src/github.com/mholt/caddy/caddy/caddy /usr/bin/caddy
COPY Caddyfile /Caddyfile
ENTRYPOINT caddy -conf /Caddyfile -log stdout
COPY --from=stackedit /stackedit/dist /usr/share/nginx/html/
ENTRYPOINT nginx -g "daemon off;"

@ -1,6 +1,6 @@
# StackEdit Docker server
Run a StackEdit v5.13.2 (October 2018) server with Caddy server in a lightweight Docker container
Run a StackEdit v5.13.2 (October 2018) server with Nginx in a lightweight Docker container
[![Docker StackEdit](https://github.com/qdm12/stackedit-docker/raw/master/readme/title.png)](https://hub.docker.com/r/qmcgaw/stackedit/)
@ -24,16 +24,15 @@ Stackedit build:
| Download size | Image size | RAM usage | CPU usage |
| --- | --- | --- | --- |
| ???MB | 51.2MB | 2-3MB | Very low |
| ???MB | 45.5MB | 7MB | Very low |
## Features
- [Stackedit features](https://github.com/benweet/stackedit/blob/master/README.md#stackedit-can)
- Lightweight image based on:
- [Stackedit 5.13.2](https://github.com/benweet/stackedit) (38MB)
- Alpine 3.8 (4.41MB)
- Caddy HTTP server (9MB)
- Robust Caddy server (you can easily add HTTPS if needed)
- [Stackedit 5.13.2](https://github.com/benweet/stackedit)
- Alpine 3.8
- Nginx HTTP server
## Setup
@ -75,3 +74,6 @@ Go to [http://localhost:8000](http://localhost:8000)
Credits to the [developers](https://github.com/benweet/stackedit/graphs/contributors)
of [StackEdit](https://stackedit.io/)
## TODOs
- [ ] Configuration of Stackedit

Loading…
Cancel
Save