Implemented docker and docker-compose.

This commit is contained in:
Marvin Blum
2020-05-19 00:13:28 +02:00
committed by Marvin Blum
parent 5d170489d8
commit 1564b6433a
2 changed files with 18 additions and 30 deletions

View File

@@ -1,33 +1,25 @@
FROM golang AS build
ADD . /go/src/github.com/special-tactical-service/wiki
WORKDIR /go/src/github.com/special-tactical-service/wiki
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_13.x -o nodesource_setup.sh && bash nodesource_setup.sh && \
apt-get install -y nodejs
COPY . /go/src/github.com/Kugelschieber/marvinblum.de
WORKDIR /go/src/github.com/Kugelschieber/marvinblum.de
RUN apt-get update && apt-get upgrade -y
# build backend
ENV GOPATH=/go
ENV CGO_ENABLED=0
RUN go build -ldflags "-s -w" main.go
# build frontend
RUN cd /go/src/github.com/special-tactical-service/wiki/public && npm i && npm rebuild node-sass && npm run build
FROM alpine
RUN apk update && \
apk upgrade && \
apk add --no-cache && \
apk add ca-certificates && \
rm -rf /var/cache/apk/*
COPY --from=build /go/src/github.com/special-tactical-service/wiki /app
COPY --from=build /go/src/github.com/Kugelschieber/marvinblum.de /app
WORKDIR /app
# default config
ENV STS_WIKI_LOGLEVEL=info
ENV STS_WIKI_ALLOWED_ORIGINS=*
ENV STS_WIKI_HOST=0.0.0.0:80
ENV MB_LOGLEVEL=info
ENV MB_ALLOWED_ORIGINS=*
ENV MB_HOST=0.0.0.0:80
EXPOSE 80
EXPOSE 443