mirror of
https://github.com/Kugelschieber/schnittfest.git
synced 2026-01-18 02:10:27 +00:00
Merge branch 'master' of https://github.com/Kugelschieber/schnittfest
This commit is contained in:
12
Dockerfile
12
Dockerfile
@@ -2,17 +2,17 @@ FROM golang AS build
|
||||
RUN apt-get update && \
|
||||
apt-get upgrade -y && \
|
||||
apt-get install -y curl && \
|
||||
curl -sL https://deb.nodesource.com/setup_12.x -o nodesource_setup.sh && bash nodesource_setup.sh && \
|
||||
curl -sL https://deb.nodesource.com/setup_13.x -o nodesource_setup.sh && bash nodesource_setup.sh && \
|
||||
apt-get install -y nodejs
|
||||
WORKDIR /go/src/github.com/Kugelschieber/schnittfest
|
||||
ADD . .
|
||||
COPY . .
|
||||
|
||||
# build server
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-s -w" /go/src/github.com/Kugelschieber/schnittfest/main.go && \
|
||||
mkdir /app && mv /go/src/github.com/Kugelschieber/schnittfest/main /app/server
|
||||
|
||||
# compile CSS
|
||||
RUN cd /go/src/github.com/Kugelschieber/schnittfest/style && bash -c "npm i" && bash -c "npm rebuild node-sass" && bash -c "npm run style"
|
||||
RUN cd /go/src/github.com/Kugelschieber/schnittfest/style && bash -c "npm i" && bash -c "npm rebuild node-sass" && bash -c "npm run build"
|
||||
|
||||
# copy resources
|
||||
RUN mv /go/src/github.com/Kugelschieber/schnittfest/template /app/template && \
|
||||
@@ -27,12 +27,6 @@ RUN apk update && \
|
||||
COPY --from=build /app /app
|
||||
WORKDIR /app
|
||||
|
||||
# use root to bind port 80 and 443
|
||||
#RUN addgroup -S appuser && \
|
||||
# adduser -S -G appuser appuser && \
|
||||
# chown -R appuser:appuser /app
|
||||
#USER appuser
|
||||
|
||||
# default config
|
||||
ENV SCHNITTFEST_HOST=0.0.0.0:80
|
||||
ENV SCHNITTFEST_LOGLEVEL=info
|
||||
|
||||
@@ -1,7 +1,49 @@
|
||||
version: '3'
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
traefik:
|
||||
image: "traefik:v2.2"
|
||||
container_name: traefik
|
||||
restart: always
|
||||
command:
|
||||
- "--providers.docker=true"
|
||||
- "--providers.docker.exposedbydefault=false"
|
||||
- "--entrypoints.web.address=:80"
|
||||
- "--entrypoints.websecure.address=:443"
|
||||
- "--certificatesresolvers.tls-resolver.acme.httpchallenge=true"
|
||||
- "--certificatesresolvers.tls-resolver.acme.httpchallenge.entrypoint=web"
|
||||
- "--certificatesresolvers.tls-resolver.acme.email=contact@schnittfest.gmbh"
|
||||
- "--certificatesresolvers.tls-resolver.acme.storage=/letsencrypt/acme.json"
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- /root/schnittfest/letsencrypt:/letsencrypt
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# Global redirection: http to https
|
||||
- 'traefik.http.routers.http-catchall.rule=HostRegexp(`{host:(www\.)?.+}`)'
|
||||
- "traefik.http.routers.http-catchall.entrypoints=web"
|
||||
- "traefik.http.routers.http-catchall.middlewares=wwwtohttps"
|
||||
# Global redirection: https (www.) to https
|
||||
- 'traefik.http.routers.wwwsecure-catchall.rule=HostRegexp(`{host:(www\.).+}`)'
|
||||
- "traefik.http.routers.wwwsecure-catchall.entrypoints=websecure"
|
||||
- "traefik.http.routers.wwwsecure-catchall.tls=true"
|
||||
- "traefik.http.routers.wwwsecure-catchall.middlewares=wwwtohttps"
|
||||
# middleware: http(s)://(www.) to https://
|
||||
- 'traefik.http.middlewares.wwwtohttps.redirectregex.regex=^https?://(?:www\.)?(.+)'
|
||||
- 'traefik.http.middlewares.wwwtohttps.redirectregex.replacement=https://$${1}'
|
||||
- 'traefik.http.middlewares.wwwtohttps.redirectregex.permanent=true'
|
||||
schnittfest:
|
||||
image: kugel/schnittfest
|
||||
ports:
|
||||
- "8080:80"
|
||||
container_name: schnittfest
|
||||
restart: always
|
||||
depends_on:
|
||||
- traefik
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.http.routers.schnittfest.rule=Host(`schnittfest.gmbh`) || Host(`www.schnittfest.gmbh`)"
|
||||
- "traefik.http.routers.schnittfest.entrypoints=websecure"
|
||||
- "traefik.http.routers.schnittfest.tls=true"
|
||||
- "traefik.http.routers.schnittfest.tls.certresolver=tls-resolver"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"description": "Schnittfest GmbH website styling.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"build": "node-sass sass/ -o ../static/ --output-style compressed",
|
||||
"style": "node-sass -w sass/ -o ../static/ --output-style compressed"
|
||||
},
|
||||
"author": "Marvin Blum, Daniel Schramm",
|
||||
|
||||
Reference in New Issue
Block a user