Added sass build and Dockerfile.

This commit is contained in:
Marvin Blum
2019-12-12 22:52:10 +01:00
parent 290aa1e0ea
commit 03839254a6
6 changed files with 1531 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
.idea/
style/node_modules/

45
Dockerfile Normal file
View File

@@ -0,0 +1,45 @@
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 && \
apt-get install -y nodejs
WORKDIR /go/src/github.com/Kugelschieber/schnittfest
ADD . .
# 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"
# copy resources
RUN mv /go/src/github.com/Kugelschieber/schnittfest/template /app/template && \
mv /go/src/github.com/Kugelschieber/schnittfest/static /app/static
FROM alpine
RUN apk update && \
apk upgrade && \
apk add --no-cache && \
apk add ca-certificates && \
rm -rf /var/cache/apk/*
COPY --from=build /app /app
WORKDIR /app
RUN addgroup -S appuser && \
adduser -S -G appuser appuser && \
chown -R appuser:appuser /app
USER appuser
# default config
ENV EMVI_WIKI_HOST=0.0.0.0:8080
ENV EMVI_WIKI_LOGLEVEL=info
ENV EMVI_WIKI_ALLOWED_ORIGINS=*
ENV EMVI_WIKI_HTTP_WRITE_TIMEOUT=5
ENV EMVI_WIKI_HTTP_READ_TIMEOUT=5
ENV EMVI_WIKI_TEMPLATE_BASE=/template
# run
EXPOSE 8080
ENTRYPOINT ["/app/server"]

1
static/main.css Normal file
View File

@@ -0,0 +1 @@
html,body{font-family:sans-serif}

1467
style/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

14
style/package.json Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "schnittfest",
"version": "1.0.0",
"description": "Schnittfest GmbH website styling.",
"main": "index.js",
"scripts": {
"style": "node-sass sass/ -o ../static/ --output-style compressed"
},
"author": "Marvin Blum, Daniel Schramm",
"license": "ISC",
"devDependencies": {
"node-sass": "^4.13.0"
}
}

3
style/sass/main.scss Normal file
View File

@@ -0,0 +1,3 @@
html, body {
font-family: sans-serif;
}