-
Notifications
You must be signed in to change notification settings - Fork 13
/
Dockerfile
33 lines (33 loc) · 1.19 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
FROM dart:3.4.4@sha256:cbe4ddbd97ffe990873306bc69edc29f252b190dbbe26fd75c5f6bd9f2fe958f AS buildimage
ENV HOMEDIR=/atsign
ENV BINARYDIR=/usr/local/at
ENV USER_ID=1024
ENV GROUP_ID=1024
WORKDIR /app
# Context for this Dockerfile needs to be at_server repo packages/at_root_server
# If building manually then (from packages/at_root_server):
## sudo docker build -t atsigncompany/root .
COPY . .
RUN set -eux ; \
mkdir -p $HOMEDIR/config ; \
mkdir -p $BINARYDIR/config ; \
dart pub get ; \
dart pub update ; \
dart compile exe bin/main.dart -o $BINARYDIR/root ; \
addgroup --gid $GROUP_ID atsign ; \
useradd --system --uid $USER_ID --gid $GROUP_ID --shell /bin/bash \
--home $HOMEDIR atsign ; \
chown -R atsign:atsign $HOMEDIR ; \
cp config/* $HOMEDIR/config/ ; \
cp config/* $BINARYDIR/config/ ; \
cp pubspec.yaml $HOMEDIR/
# Second stage of build FROM scratch
FROM scratch
COPY --from=buildimage /runtime/ /
COPY --from=buildimage /etc/passwd /etc/passwd
COPY --from=buildimage /etc/group /etc/group
COPY --from=buildimage --chown=atsign:atsign /atsign /atsign/
COPY --from=buildimage --chown=atsign:atsign /usr/local/at /usr/local/at/
WORKDIR /atsign
USER atsign
ENTRYPOINT ["/usr/local/at/root"]