Fix and explain user buildargs (#49)

* expose GID AND UID as optional build args

* Give examples on how to use the build-time args in docker-compose

* Prevent overwriting of build args

* Warn about using regular docker run
This commit is contained in:
peterrus 2022-03-17 15:21:04 +01:00 committed by GitHub
parent abe0dc3cb8
commit 09fa1e81e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 9 deletions

View file

@ -1,11 +1,8 @@
FROM elixir:1.11.4-alpine FROM elixir:1.11.4-alpine
ENV UID=911 GID=911 \
MIX_ENV=prod
ARG PLEROMA_VER=develop ARG PLEROMA_VER=develop
ENV UID=911 GID=911 MIX_ENV=prod ARG UID=911
ARG GID=911
ENV MIX_ENV=prod ENV MIX_ENV=prod
RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories \ RUN echo "http://nl.alpinelinux.org/alpine/latest-stable/community" >> /etc/apk/repositories \

View file

@ -49,12 +49,19 @@ services:
- ./postgres:/var/lib/postgresql/data - ./postgres:/var/lib/postgresql/data
web: web:
build: .
image: pleroma image: pleroma
container_name: pleroma_web container_name: pleroma_web
restart: always restart: always
ports: ports:
- '4000:4000' - '4000:4000'
build:
context: .
# Feel free to remove or override this section
# See 'Build-time variables' in README.md
args:
- "UID=911"
- "GID=911"
- "PLEROMA_VER=develop"
volumes: volumes:
- ./uploads:/var/lib/pleroma/uploads - ./uploads:/var/lib/pleroma/uploads
- ./static:/var/lib/pleroma/static - ./static:/var/lib/pleroma/static
@ -133,7 +140,7 @@ docker-compose build
docker build -t pleroma . docker build -t pleroma .
``` ```
I prefer the latter because it's more verbose. I prefer the latter because it's more verbose but this will ignore any build-time variables you have set in `docker-compose.yml`.
Setup the database: Setup the database:
@ -200,6 +207,8 @@ docker build -t pleroma . --build-arg PLEROMA_VER=v2.0.7 # a version
`a9203ab3` being the hash of the commit. (They're [here](https://git.pleroma.social/pleroma/pleroma/commits/develop)) `a9203ab3` being the hash of the commit. (They're [here](https://git.pleroma.social/pleroma/pleroma/commits/develop))
This value can also be set through `docker-compose.yml` as seen in the example file provided in this repository.
## Other Docker images ## Other Docker images
Here are other Pleroma Docker images that helped me build mine: Here are other Pleroma Docker images that helped me build mine:

View file

@ -15,7 +15,6 @@ services:
- ./postgres:/var/lib/postgresql/data - ./postgres:/var/lib/postgresql/data
web: web:
build: .
image: pleroma image: pleroma
container_name: pleroma_web container_name: pleroma_web
healthcheck: healthcheck:
@ -27,6 +26,14 @@ services:
restart: always restart: always
ports: ports:
- '4000:4000' - '4000:4000'
build:
context: .
# Feel free to remove or override this section
# See 'Build-time variables' in README.md
args:
- "UID=1000"
- "GID=1000"
- "PLEROMA_VER=v2.4.2"
volumes: volumes:
- ./uploads:/var/lib/pleroma/uploads - ./uploads:/var/lib/pleroma/uploads
- ./static:/var/lib/pleroma/static - ./static:/var/lib/pleroma/static