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 FROM alpine:3.8 AS stackedit
RUN echo https://alpine.global.ssl.fastly.net/alpine/v3.8/main > /etc/apk/repositories && \ RUN echo https://alpine.global.ssl.fastly.net/alpine/v3.8/main > /etc/apk/repositories && \
apk add -q --progress --update --no-cache git npm apk add -q --progress --update --no-cache git npm
@ -16,16 +6,13 @@ WORKDIR /stackedit
RUN npm install RUN npm install
RUN npm run build RUN npm run build
FROM alpine:3.8 FROM nginx:1.15-alpine
LABEL maintainer="quentin.mcgaw@gmail.com" \ LABEL maintainer="quentin.mcgaw@gmail.com" \
description="StackEdit server in a lightweight Docker container" \ description="StackEdit server in a lightweight Docker container" \
download="???MB" \ download="???MB" \
size="51.2MB" \ size="45.5MB" \
ram="2MB-3MB" \ ram="7MB" \
cpu_usage="Very low" \ cpu_usage="Very low" \
github="https://github.com/qdm12/stackedit-docker" github="https://github.com/qdm12/stackedit-docker"
EXPOSE 80 COPY --from=stackedit /stackedit/dist /usr/share/nginx/html/
COPY --from=stackedit /stackedit/dist /stackedit ENTRYPOINT nginx -g "daemon off;"
COPY --from=caddy /go/src/github.com/mholt/caddy/caddy/caddy /usr/bin/caddy
COPY Caddyfile /Caddyfile
ENTRYPOINT caddy -conf /Caddyfile -log stdout

@ -1,6 +1,6 @@
# StackEdit Docker server # 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/) [![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 | | Download size | Image size | RAM usage | CPU usage |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| ???MB | 51.2MB | 2-3MB | Very low | | ???MB | 45.5MB | 7MB | Very low |
## Features ## Features
- [Stackedit features](https://github.com/benweet/stackedit/blob/master/README.md#stackedit-can) - [Stackedit features](https://github.com/benweet/stackedit/blob/master/README.md#stackedit-can)
- Lightweight image based on: - Lightweight image based on:
- [Stackedit 5.13.2](https://github.com/benweet/stackedit) (38MB) - [Stackedit 5.13.2](https://github.com/benweet/stackedit)
- Alpine 3.8 (4.41MB) - Alpine 3.8
- Caddy HTTP server (9MB) - Nginx HTTP server
- Robust Caddy server (you can easily add HTTPS if needed)
## Setup ## Setup
@ -75,3 +74,6 @@ Go to [http://localhost:8000](http://localhost:8000)
Credits to the [developers](https://github.com/benweet/stackedit/graphs/contributors) Credits to the [developers](https://github.com/benweet/stackedit/graphs/contributors)
of [StackEdit](https://stackedit.io/) of [StackEdit](https://stackedit.io/)
## TODOs
- [ ] Configuration of Stackedit

Loading…
Cancel
Save