-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
74 lines (60 loc) · 2.05 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
ARG BASEIMAGE=alpine:latest
FROM $BASEIMAGE as build-container
ARG CLIENT_TAG=latest
ENV SENTRY_DSN=$SENTRY_DSN
RUN apk add --no-cache --update \
nodejs \
npm \
libstdc++ \
make \
gcc \
g++ \
python3 && \
npm install -g --unsafe-perm npm
COPY package*.json "/@ubud-app/server/"
WORKDIR "/@ubud-app/server"
RUN npm ci
COPY . "/@ubud-app/server/"
RUN npm i "@ubud-app/client@$CLIENT_TAG" --save-optional --no-audit
FROM $BASEIMAGE
ARG UID=1000
ARG GID=1000
ARG CLIENT_TAG=latest
ARG NODE_ENV=production
ARG NEXT
ARG SENTRY_DSN
# Build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG VCS_REF
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="ubud app" \
org.label-schema.description="A small, selfhosted software for personal budgeting." \
org.label-schema.url="https://ubud.club" \
org.label-schema.usage="https://github.com/ubud-app/server#-quick-start" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/ubud-app/server" \
org.label-schema.vendor="Sebastian Pekarek" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"
ENV NODE_ENV=$NODE_ENV
ENV SENTRY_DSN=$SENTRY_DSN
ENV NEXT=$NEXT
RUN apk add --no-cache --update \
nodejs \
npm && \
npm install -g --unsafe-perm npm && \
addgroup -g $GID ubud && \
adduser -u $UID -G ubud -s /bin/sh -D ubud
COPY --from=build-container "/@ubud-app" "/@ubud-app"
RUN ln -s "/@ubud-app/server/bin/database" "/usr/local/bin/ubud-db" && \
ln -s "/@ubud-app/server/bin/plugin" "/usr/local/bin/ubud-plugin" && \
ln -s "/@ubud-app/server/bin/user" "/usr/local/bin/ubud-user" && \
ln -s "/@ubud-app/server/server.js" "/usr/local/bin/ubud-server" && \
chown -R ubud:ubud /@ubud-app/server && \
chown -R ubud:ubud /@ubud-app/server/node_modules && \
chown -R ubud:ubud /@ubud-app/server/package.json && \
chown -R ubud:ubud /@ubud-app/server/package-lock.json
USER ubud
WORKDIR "/@ubud-app/server"
CMD ubud-server