Skip to content

Commit

Permalink
Avoid hardcoded UID and GID in docker build
Browse files Browse the repository at this point in the history
The [Dockerfile](https://github.com/nextstrain/docs.nextstrain.org/blob/1da467787db9a8f9b43724f3c41264fa30ff4db6/Dockerfile) uses `UID` and `GID` args to create a user inside the container. Files are then written during build on behalf of this user, to avoid permission problems.

Mistakenly, these variables were both hardcoded to `1000`, which is fine for a single-user Linux host, bot not for macOS. 

This PR passes `UID` and `GID` from the host system as build args, so that the files are written on behalf of the the current user.
  • Loading branch information
ivan-aksamentov committed Aug 3, 2021
1 parent 1da4677 commit 1ea65c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ FROM continuumio/miniconda3:4.9.2
ARG DEBIAN_FRONTEND=noninteractive
ARG USER=user
ARG GROUP=user
ARG UID=1000
ARG GID=1000
ARG UID
ARG GID

ENV TERM="xterm-256color"
ENV HOME="/home/user"
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ help:
.ONESHELL:
docker-html:
set -euox
docker build -t nextstrain-docs-builder --network=host .
docker build -t nextclade-docs-builder \
--network=host \
--build-arg UID=$(shell id -u) \
--build-arg GID=$(shell id -g) \
.
docker run -it --rm \
--name=nextstrain-docs-builder-$(shell date +%s) \
--init \
Expand Down

0 comments on commit 1ea65c1

Please sign in to comment.