refactor Dockerfile to work with current version
this changes the Dockerfile a bit to work with the current version 0.10.0 of writefreely, and removes the docker-setup script for now. Kind of a work in progress but wanted to share with those interested.
This commit is contained in:
parent
8557119451
commit
2ec67fc26a
8 changed files with 45 additions and 39 deletions
|
@ -1,2 +1,4 @@
|
||||||
Dockerfile
|
Dockerfile
|
||||||
.git
|
.git
|
||||||
|
config.ini
|
||||||
|
writefreely.db
|
44
Dockerfile
44
Dockerfile
|
@ -1,35 +1,25 @@
|
||||||
# Build image
|
FROM golang:1.12-alpine AS build
|
||||||
FROM golang:1.12-alpine as build
|
|
||||||
|
|
||||||
RUN apk add --update nodejs nodejs-npm make g++ git sqlite-dev
|
RUN apk add nodejs nodejs-npm make g++ ca-certificates git sqlite-dev && \
|
||||||
RUN npm install -g less less-plugin-clean-css
|
npm install -g less less-plugin-clean-css && \
|
||||||
RUN go get -u github.com/jteeuwen/go-bindata/...
|
go get -u github.com/jteeuwen/go-bindata/...
|
||||||
|
|
||||||
RUN mkdir -p /go/src/github.com/writeas/writefreely
|
WORKDIR /src
|
||||||
WORKDIR /go/src/github.com/writeas/writefreely
|
COPY ./go.mod ./go.sum ./
|
||||||
|
RUN go mod download
|
||||||
COPY . .
|
COPY . .
|
||||||
|
RUN make assets ui && cd cmd/writefreely && go build -v -tags='sqlite'
|
||||||
|
|
||||||
ENV GO111MODULE=on
|
RUN mkdir -p \
|
||||||
RUN make build \
|
/home/writefreely/static /home/writefreely/templates /home/writefreely/pages && \
|
||||||
&& make ui
|
cp -r templates/ pages/ static/ /home/writefreely
|
||||||
RUN mkdir /stage && \
|
|
||||||
cp -R /go/bin \
|
|
||||||
/go/src/github.com/writeas/writefreely/templates \
|
|
||||||
/go/src/github.com/writeas/writefreely/static \
|
|
||||||
/go/src/github.com/writeas/writefreely/pages \
|
|
||||||
/go/src/github.com/writeas/writefreely/keys \
|
|
||||||
/go/src/github.com/writeas/writefreely/cmd \
|
|
||||||
/stage
|
|
||||||
|
|
||||||
# Final image
|
FROM alpine AS final
|
||||||
FROM alpine:3.8
|
|
||||||
|
|
||||||
RUN apk add --no-cache openssl ca-certificates
|
# TODO user nobody or similar
|
||||||
COPY --from=build --chown=daemon:daemon /stage /go
|
COPY --from=build /src/cmd/writefreely/writefreely /bin
|
||||||
|
COPY --from=build /home /home
|
||||||
|
|
||||||
WORKDIR /go
|
|
||||||
VOLUME /go/keys
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
USER daemon
|
WORKDIR /home/writefreely
|
||||||
|
ENTRYPOINT [ "writefreely" ]
|
||||||
ENTRYPOINT ["cmd/writefreely/writefreely"]
|
|
3
Makefile
3
Makefile
|
@ -19,6 +19,9 @@ ci: ci-assets deps
|
||||||
build: assets deps
|
build: assets deps
|
||||||
cd cmd/writefreely; $(GOBUILD) -v -tags='sqlite'
|
cd cmd/writefreely; $(GOBUILD) -v -tags='sqlite'
|
||||||
|
|
||||||
|
build-no-git: assets deps
|
||||||
|
cd cmd/writefreely; $(GOCMD) build -v -tags='sqlite'
|
||||||
|
|
||||||
build-no-sqlite: assets-no-sqlite deps-no-sqlite
|
build-no-sqlite: assets-no-sqlite deps-no-sqlite
|
||||||
cd cmd/writefreely; $(GOBUILD) -v -o $(BINARY_NAME)
|
cd cmd/writefreely; $(GOBUILD) -v -o $(BINARY_NAME)
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gopkg.in/ini.v1"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"gopkg.in/ini.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
16
docker-compose.sqlite.yml
Normal file
16
docker-compose.sqlite.yml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
web:
|
||||||
|
image: robjloranger/writefreely:v0.10.0
|
||||||
|
volumes:
|
||||||
|
- ./keys:/home/writefreely/keys
|
||||||
|
- ./config.ini:/home/writefreely/config.ini
|
||||||
|
- ./writefreely.db:/home/writefreely/writefreely.db
|
||||||
|
ports:
|
||||||
|
- "8080:8080"
|
||||||
|
networks:
|
||||||
|
- writefreely
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
networks:
|
||||||
|
writefreely:
|
|
@ -1,10 +1,10 @@
|
||||||
version: "3"
|
version: "3"
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build: .
|
image: robjloranger/writefreely:v0.10.0
|
||||||
volumes:
|
volumes:
|
||||||
- "web-data:/go/src/app"
|
- ./keys:/home/writefreely/keys
|
||||||
- "./config.ini.example:/go/src/app/config.ini"
|
- ./config.ini:/home/writefreely/config.ini
|
||||||
ports:
|
ports:
|
||||||
- "8080:8080"
|
- "8080:8080"
|
||||||
networks:
|
networks:
|
||||||
|
@ -15,7 +15,6 @@ services:
|
||||||
db:
|
db:
|
||||||
image: "mariadb:latest"
|
image: "mariadb:latest"
|
||||||
volumes:
|
volumes:
|
||||||
- "./schema.sql:/tmp/schema.sql"
|
|
||||||
- db-data:/var/lib/mysql/data
|
- db-data:/var/lib/mysql/data
|
||||||
networks:
|
networks:
|
||||||
- writefreely
|
- writefreely
|
||||||
|
@ -25,7 +24,6 @@ services:
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
web-data:
|
|
||||||
db-data:
|
db-data:
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
docker-compose exec db sh -c 'exec mysql -u root -pchangeme writefreely < /tmp/schema.sql'
|
|
||||||
docker exec writefreely_web_1 writefreely --gen-keys
|
|
||||||
docker exec -it writefreely_web_1 writefreely --config
|
|
2
go.mod
2
go.mod
|
@ -63,7 +63,7 @@ require (
|
||||||
github.com/writeas/slug v1.2.0
|
github.com/writeas/slug v1.2.0
|
||||||
github.com/writeas/web-core v1.0.0
|
github.com/writeas/web-core v1.0.0
|
||||||
github.com/writefreely/go-nodeinfo v1.2.0
|
github.com/writefreely/go-nodeinfo v1.2.0
|
||||||
golang.org/x/crypto v0.0.0-20190208162236-193df9c0f06f // indirect
|
golang.org/x/crypto v0.0.0-20190208162236-193df9c0f06f
|
||||||
golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 // indirect
|
golang.org/x/lint v0.0.0-20181217174547-8f45f776aaf1 // indirect
|
||||||
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 // indirect
|
golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 // indirect
|
||||||
golang.org/x/sys v0.0.0-20190209173611-3b5209105503 // indirect
|
golang.org/x/sys v0.0.0-20190209173611-3b5209105503 // indirect
|
||||||
|
|
Loading…
Add table
Reference in a new issue