Fixes broken Docker/docker-compose structures.

Updates versions and uses maria DB instead of sqlite in the
docker-compose. Also fixes things related to networks, generating
config, etc.
This commit is contained in:
Conor Flynn 2020-10-26 13:50:11 +00:00
parent 3493921837
commit 0eb1a2deec
3 changed files with 48 additions and 59 deletions

View File

@ -1,17 +1,19 @@
# Build image # Build image
FROM golang:1.13-alpine as build FROM golang:1.14-alpine as build
RUN apk add --update nodejs nodejs-npm make g++ git sqlite-dev RUN apk add --update nodejs nodejs-npm make g++ git
RUN npm install -g less less-plugin-clean-css RUN npm install -g less less-plugin-clean-css
RUN go get -u github.com/jteeuwen/go-bindata/... RUN go get -u github.com/go-bindata/go-bindata/...
RUN mkdir -p /go/src/github.com/writeas/writefreely RUN mkdir -p /go/src/github.com/writeas/writefreely
WORKDIR /go/src/github.com/writeas/writefreely WORKDIR /go/src/github.com/writeas/writefreely
COPY . . COPY . .
ENV GO111MODULE=on ENV GO111MODULE=on
RUN make build \ RUN make build \
&& make ui && make ui
RUN mkdir /stage && \ RUN mkdir /stage && \
cp -R /go/bin \ cp -R /go/bin \
/go/src/github.com/writeas/writefreely/templates \ /go/src/github.com/writeas/writefreely/templates \
@ -22,7 +24,7 @@ RUN mkdir /stage && \
/stage /stage
# Final image # Final image
FROM alpine:3.11 FROM alpine:3.12
RUN apk add --no-cache openssl ca-certificates RUN apk add --no-cache openssl ca-certificates
COPY --from=build --chown=daemon:daemon /stage /go COPY --from=build --chown=daemon:daemon /stage /go

View File

@ -1,28 +0,0 @@
[server]
hidden_host =
port = 8080
[database]
type = mysql
username = root
password = changeme
database = writefreely
host = db
port = 3306
tls = false
[app]
site_name = WriteFreely Example Blog!
host = http://localhost:8080
theme = write
disable_js = false
webfonts = true
single_user = true
open_registration = false
min_username_len = 3
max_blogs = 1
federation = true
public_stats = true
private = false
update_checks = true

View File

@ -1,32 +1,47 @@
version: "3" version: "3"
services:
web:
build: .
volumes:
- "web-data:/go/src/app"
- "./config.ini.example:/go/src/app/config.ini"
ports:
- "8080:8080"
networks:
- writefreely
depends_on:
- db
restart: unless-stopped
db:
image: "mariadb:latest"
volumes:
- "./schema.sql:/tmp/schema.sql"
- db-data:/var/lib/mysql/data
networks:
- writefreely
environment:
- MYSQL_DATABASE=writefreely
- MYSQL_ROOT_PASSWORD=changeme
restart: unless-stopped
volumes: volumes:
web-data: web-keys:
db-data: db-data:
networks: networks:
writefreely: external_writefreely:
internal_writefreely:
internal: true
services:
writefreely-web:
container_name: "writefreely-web"
image: "conor-f:writefreely"
volumes:
- "web-keys:/go/keys"
- "./config.ini:/go/config.ini"
networks:
- "internal_writefreely"
- "external_writefreely"
ports:
- "8080:8080"
depends_on:
- "writefreely-db"
restart: unless-stopped
writefreely-db:
container_name: "writefreely-db"
image: "mariadb:latest"
volumes:
- "db-data:/var/lib/mysql/data"
networks:
- "internal_writefreely"
environment:
- MYSQL_DATABASE=writefreely
- MYSQL_ROOT_PASSWORD=changeme
restart: unless-stopped