1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: do not attempt to bind on ipv6 in docker (resolve #84)

This commit is contained in:
Ferdinand Mütsch 2021-01-07 10:04:36 +01:00
parent 9766d8e903
commit 262bee9022
3 changed files with 14 additions and 16 deletions

View File

@ -1 +1,6 @@
.env
.env
config*.yml
!config.default.yml
*.db
*.exe
wakapi

View File

@ -1,6 +1,6 @@
# Build Stage
FROM golang:1.13 AS build-env
FROM golang:1.15 AS build-env
WORKDIR /src
ADD ./go.mod .
RUN go mod download
@ -8,19 +8,11 @@ RUN go mod download
ADD . .
RUN go build -o wakapi
# Final Stage
# Run Stage
# When running the application using `docker run`, you can pass environment variables
# to override config values using `-e` syntax.
# Available options are:
# WAKAPI_DB_TYPE
# WAKAPI_DB_USER
# WAKAPI_DB_PASSWORD
# WAKAPI_DB_HOST
# WAKAPI_DB_PORT
# WAKAPI_DB_NAME
# WAKAPI_PASSWORD_SALT
# WAKAPI_BASE_PATH
# Available options can be found in [README.md#-configuration](README.md#-configuration)
FROM debian
WORKDIR /app
@ -32,13 +24,14 @@ ENV WAKAPI_DB_PASSWORD ''
ENV WAKAPI_DB_HOST ''
ENV WAKAPI_DB_NAME=/data/wakapi.db
ENV WAKAPI_PASSWORD_SALT ''
ENV WAKAPI_LISTEN_IPV4 '0.0.0.0'
ENV WAKAPI_INSECURE_COOKIES 'true'
COPY --from=build-env /src/wakapi /app/
COPY --from=build-env /src/config.default.yml /app/config.yml
COPY --from=build-env /src/version.txt /app/
RUN sed -i 's/listen_ipv4: 127.0.0.1/listen_ipv4: 0.0.0.0/g' /app/config.yml
RUN sed -i 's/insecure_cookies: false/insecure_cookies: true/g' /app/config.yml
RUN sed -i 's/listen_ipv6: ::1/listen_ipv6: /g' /app/config.yml
ADD static /app/static
ADD data /app/data

View File

@ -54,7 +54,7 @@ To use the hosted version set `api_url = https://wakapi.dev/api/heartbeat`. Howe
### Run with Docker
```bash
docker run -d -p 3000:3000 --name wakapi n1try/wakapi
docker run -d -p 3000:3000 -e "WAKAPI_PASSWORD_SALT=$(openssl rand -hex 16)" --name wakapi n1try/wakapi
```
By default, SQLite is used as a database. To run Wakapi in Docker with MySQL or Postgres, see [Dockerfile](https://github.com/muety/wakapi/blob/master/Dockerfile) and [config.default.yml](https://github.com/muety/wakapi/blob/master/config.default.yml) for further options.
@ -73,7 +73,7 @@ You can specify configuration options either via a config file (default: `config
| `app.custom_languages` | - | - | Map from file endings to language names |
| `server.port` | `WAKAPI_PORT` | `3000` | Port to listen on |
| `server.listen_ipv4` | `WAKAPI_LISTEN_IPV4` | `127.0.0.1` | IPv4 network address to listen on (leave blank to disable IPv4) |
| `server.listen_ipv6` | `WAKAPI_LISTEN_IPV6` | `` | IPv6 network address to listen on (leave blank to disable IPv6) |
| `server.listen_ipv6` | `WAKAPI_LISTEN_IPV6` | `::1` | IPv6 network address to listen on (leave blank to disable IPv6) |
| `server.tls_cert_path` | `WAKAPI_TLS_CERT_PATH` | - | Path of SSL server certificate (leave blank to not use HTTPS) |
| `server.tls_key_path` | `WAKAPI_TLS_KEY_PATH` | - | Path of SSL server private key (leave blank to not use HTTPS) |
| `server.base_path` | `WAKAPI_BASE_PATH` | `/` | Web base path (change when running behind a proxy under a sub-path) |