Skip to content
This repository has been archived by the owner on Apr 26, 2019. It is now read-only.

Commit

Permalink
Allow users to build images by providing uid and gid as build args.
Browse files Browse the repository at this point in the history
  • Loading branch information
varshavaradarajan committed Sep 11, 2017
1 parent b40b792 commit be41207
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Dockerfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ ADD <%= meta[:url] %> <%= file %>
# force encoding
ENV LANG=en_US.utf8

ARG UID=1000
ARG GID=1000

RUN \
<% unless add_files.empty? -%>
# add mode and permissions for files we added above
Expand Down
12 changes: 6 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ tini_and_gosu_add_file_meta = {
}

create_user_and_group_cmd = [
'groupadd -g 1000 go',
'useradd -u 1000 -g go -d /home/go -m go'
'groupadd -g ${GID} go',
'useradd -u ${UID} -g go -d /home/go -m go'
]

[
Expand All @@ -63,8 +63,8 @@ create_user_and_group_cmd = [
version: '3.5',
add_files: tini_and_gosu_add_file_meta,
create_user_and_group: [
'addgroup -g 1000 go',
'adduser -D -u 1000 -G go go'
'addgroup -g ${GID} go',
'adduser -D -u ${UID} -G go go'
],
before_install: [
'apk --no-cache upgrade',
Expand All @@ -76,8 +76,8 @@ create_user_and_group_cmd = [
version: '3.6',
add_files: tini_and_gosu_add_file_meta,
create_user_and_group: [
'addgroup -g 1000 go',
'adduser -D -u 1000 -G go go'
'addgroup -g ${GID} go',
'adduser -D -u ${UID} -G go go'
],
before_install: [
'apk --no-cache upgrade',
Expand Down

0 comments on commit be41207

Please sign in to comment.