mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
docker: fix docker file image and apply some good practices (#552)
* docker: fix docker file image and apply some good practices * update docker-compose
This commit is contained in:
parent
0811052a9b
commit
41d01c18fb
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@ -0,0 +1,9 @@
|
||||
CHANGELOG.md
|
||||
README.md
|
||||
|
||||
.github/
|
||||
mac/
|
||||
win-wpf/
|
||||
mattermost-plugin/
|
||||
website/
|
||||
linux/
|
@ -7,7 +7,7 @@
|
||||
# docker cp test:/dist/focalboard-server-linux-amd64.tar.gz .
|
||||
|
||||
# build frontend
|
||||
FROM node:16.1.0 AS frontend
|
||||
FROM node:16.3.0 AS frontend
|
||||
|
||||
WORKDIR /webapp
|
||||
COPY webapp .
|
||||
@ -16,7 +16,7 @@ RUN npm install --no-optional
|
||||
RUN npm run pack
|
||||
|
||||
# build backend and package
|
||||
FROM golang:1.16.4 AS backend
|
||||
FROM golang:1.16.5 AS backend
|
||||
|
||||
COPY . .
|
||||
COPY --from=frontend /webapp/pack webapp/pack
|
||||
|
@ -1,40 +1,36 @@
|
||||
FROM golang:alpine as gobuild
|
||||
### Webapp build
|
||||
FROM node:16.3.0 as nodebuild
|
||||
|
||||
RUN apk update && \
|
||||
apk add ca-certificates gcc git make musl-dev && \
|
||||
git clone https://github.com/mattermost/focalboard && \
|
||||
cd focalboard && \
|
||||
make server-linux
|
||||
WORKDIR /webapp
|
||||
ADD webapp/ /webapp
|
||||
|
||||
FROM node:alpine as nodebuild
|
||||
RUN npm install --no-optional && \
|
||||
npm run pack
|
||||
|
||||
RUN apk update && \
|
||||
apk add ca-certificates git && \
|
||||
git clone https://github.com/mattermost/focalboard && \
|
||||
cd focalboard/webapp && \
|
||||
npm install && npm run pack
|
||||
### Go build
|
||||
FROM golang:1.16.5 as gobuild
|
||||
|
||||
FROM alpine:latest
|
||||
WORKDIR /go/src/focalboard
|
||||
ADD . /go/src/focalboard
|
||||
|
||||
ARG PUID=2000
|
||||
ARG PGID=2000
|
||||
RUN make server-linux
|
||||
|
||||
## Final image
|
||||
FROM gcr.io/distroless/base-debian10
|
||||
|
||||
WORKDIR /opt/focalboard
|
||||
|
||||
COPY --from=nodebuild /webapp/pack pack/
|
||||
COPY --from=gobuild /go/src/focalboard/bin/linux/focalboard-server bin/
|
||||
COPY --from=gobuild /go/src/focalboard/LICENSE.txt LICENSE.txt
|
||||
COPY --from=gobuild /go/src/focalboard/docker/server_config.json config.json
|
||||
|
||||
USER nobody
|
||||
|
||||
EXPOSE 8000/tcp
|
||||
|
||||
EXPOSE 8000/tcp 9092/tcp
|
||||
|
||||
VOLUME /data
|
||||
|
||||
RUN addgroup -g ${PGID} focalboard && \
|
||||
adduser -H -D -u ${PUID} -G focalboard focalboard
|
||||
|
||||
WORKDIR /opt/focalboard
|
||||
|
||||
COPY --from=gobuild /go/focalboard/bin/linux/focalboard-server bin/
|
||||
COPY --from=nodebuild /focalboard/webapp/pack pack/
|
||||
COPY --from=nodebuild /focalboard/LICENSE.txt LICENSE.txt
|
||||
COPY --from=nodebuild /focalboard/docker/server_config.json config.json
|
||||
|
||||
RUN chown -R ${PUID}:${PGID} /opt/focalboard
|
||||
|
||||
USER focalboard
|
||||
|
||||
CMD ["/opt/focalboard/bin/focalboard-server"]
|
||||
|
@ -1,30 +1,40 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ./
|
||||
context: ../
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: focalboard
|
||||
depends_on:
|
||||
- focalboard-db
|
||||
expose:
|
||||
- 8000
|
||||
environment:
|
||||
- VIRTUAL_HOST=focalboard.local
|
||||
- VIRTUAL_HOST=localhost
|
||||
- VIRTUAL_PORT=8000
|
||||
- VIRTUAL_PROTO=http
|
||||
volumes:
|
||||
- "./config.json:/opt/focalboard/config.json"
|
||||
restart: always
|
||||
networks:
|
||||
- proxy
|
||||
- default
|
||||
|
||||
proxy:
|
||||
image: jwilder/nginx-proxy:latest
|
||||
container_name: focalboard-proxy
|
||||
restart: always
|
||||
ports:
|
||||
- 443:443
|
||||
- 80:80
|
||||
volumes:
|
||||
- "./certs:/etc/nginx/certs:ro"
|
||||
- "/var/run/docker.sock:/tmp/docker.sock:ro"
|
||||
- /var/run/docker.sock:/tmp/docker.sock:ro
|
||||
networks:
|
||||
- proxy
|
||||
|
||||
focalboard-db:
|
||||
image: postgres:latest
|
||||
restart: always
|
||||
container_name: focalboard-postgres
|
||||
restart: always
|
||||
volumes:
|
||||
@ -34,3 +44,5 @@ services:
|
||||
POSTGRES_USER: boardsuser
|
||||
POSTGRES_PASSWORD: boardsuser-password
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
|
@ -2,11 +2,11 @@ version: "3"
|
||||
services:
|
||||
app:
|
||||
build:
|
||||
context: ./
|
||||
context: ../
|
||||
dockerfile: docker/Dockerfile
|
||||
container_name: focalboard
|
||||
ports:
|
||||
- 80:8000
|
||||
environment:
|
||||
- VIRTUAL_HOST=focalboard.local
|
||||
- VIRTUAL_PORT=8000
|
||||
|
||||
|
@ -1 +1 @@
|
||||
v16.1.0
|
||||
v16.3.0
|
||||
|
@ -2,18 +2,18 @@
|
||||
|
||||
This folder is used to manage the website at [focalboard.com](https://www.focalboard.com/). It was built using [Hugo](https://gohugo.io/).
|
||||
|
||||
- The main page for https://focalboard.com can be found at [/site/layouts/partials/hero.htm](site/layouts/partials).
|
||||
- Other content can be found in the [/site/content](site/content) folder.
|
||||
- The main page for https://focalboard.com can be found at [/site/layouts/partials/hero.htm](site/layouts/partials).
|
||||
- Other content can be found in the [/site/content](site/content) folder.
|
||||
|
||||
## How to contribute
|
||||
## How to contribute
|
||||
|
||||
You're welcome to submit pull requests for typos, minor corrects and additions, troubleshooting tips to install guides and other incremental improvements.
|
||||
You're welcome to submit pull requests for typos, minor corrects and additions, troubleshooting tips to install guides and other incremental improvements.
|
||||
|
||||
For larger changes, such as adding an install guide for a different platform, please create a [feature request](https://github.com/mattermost/focalboard/issues/new?assignees=&labels=enhancement&template=enhancement.md&title=Feature+Request%3A+) ticket to discuss.
|
||||
For larger changes, such as adding an install guide for a different platform, please create a [feature request](https://github.com/mattermost/focalboard/issues/new?assignees=&labels=enhancement&template=enhancement.md&title=Feature+Request%3A+) ticket to discuss.
|
||||
|
||||
## How to build locally
|
||||
## How to build locally
|
||||
|
||||
If you're interested in building the website locally from this repo using Hugo, please use the following steps:
|
||||
If you're interested in building the website locally from this repo using Hugo, please use the following steps:
|
||||
|
||||
1. Follow [Hugo documentation](https://gohugo.io/getting-started/installing/) to install Hugo
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user