fix docker files

This commit is contained in:
shibao 2022-02-25 21:35:22 -05:00
parent b04fce2142
commit 9bc101adbe
2 changed files with 26 additions and 8 deletions

View File

@ -1,4 +1,4 @@
FROM elixir:1.12.2-alpine AS build FROM elixir:1.13-alpine AS build
# install build dependencies # install build dependencies
RUN apk add --no-cache build-base npm git python3 RUN apk add --no-cache build-base npm git python3
@ -34,7 +34,7 @@ RUN mix do phx.digest, gettext.extract
RUN mix do compile, release RUN mix do compile, release
# prepare release image # prepare release image
FROM alpine:3.9 AS app FROM alpine:latest AS app
RUN apk upgrade --no-cache && \ RUN apk upgrade --no-cache && \
apk add --no-cache bash openssl libgcc libstdc++ ncurses-libs apk add --no-cache bash openssl libgcc libstdc++ ncurses-libs
@ -45,8 +45,9 @@ RUN chown nobody:nobody /app
USER nobody:nobody USER nobody:nobody
COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/lokal /app COPY --from=build --chown=nobody:nobody /app/_build/prod/rel/lokal ./
COPY --from=build /app/priv/ /app/priv COPY --from=build --chown=nobody:nobody /app/priv /app/priv
RUN chmod +x /app/priv/random.sh
ENV HOME=/app ENV HOME=/app

View File

@ -7,9 +7,26 @@ services:
container_name: lokal container_name: lokal
restart: always restart: always
environment: environment:
- DATABASE_URL="ecto://postgres:postgres@lokal-db/lokal" # HOST must be set!
# generate a random base64 string 64 characters long, preferably not from a website # - HOST=your.domain.com
- SECRET_KEY_BASE="change-me-to-something-random-this-is-really-important-change-it" - DATABASE_URL=ecto://postgres:postgres@lokal-db/lokal
# Use `docker run -it shibaobun/lokal /app/priv/random.sh` to generate a secret key base
# - SECRET_KEY_BASE=change-me-this-is-really-important-seriously-change-it
# uncomment to enable public sign ups, not recommended
# - REGISTRATION=public
# SMTP host must be set!
# - SMTP_HOST=smtp.mailserver.tld
# optional, default is 587
# - SMTP_PORT=587
# SMTP username/passwords must be set!
# - SMTP_USERNAME=username
# - SMTP_PASSWORD=password
# optional, default is false
# - SMTP_SSL=false
# optional, default is format below
# - EMAIL_FROM=no-reply@lokal.example.tld
# optional, default is "Lokal"
# - EMAIL_NAME=Lokal
expose: expose:
- "4000" - "4000"
depends_on: depends_on:
@ -18,10 +35,10 @@ services:
lokal-db: lokal-db:
image: postgres:13 image: postgres:13
container_name: lokal-db container_name: lokal-db
restart: always
environment: environment:
- POSTGRES_USER="postgres" - POSTGRES_USER="postgres"
- POSTGRES_PASSWORD="postgres" - POSTGRES_PASSWORD="postgres"
- POSTGRES_DB="lokal" - POSTGRES_DB="lokal"
restart: always
volumes: volumes:
- ./data:/var/lib/postgresql/data - ./data:/var/lib/postgresql/data