This repository has been archived by the owner on Feb 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
app.Dockerfile
78 lines (55 loc) · 2.21 KB
/
app.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
75
76
77
78
########################################################
# joplin-common
FROM cityofaustin/joplin-base:1a73da0 as joplin-common
# Install Python dependencies
COPY "$PWD/Pipfile" ./Pipfile
COPY "$PWD/Pipfile.lock" ./Pipfile.lock
# Create requirements.txt from Pipfile
RUN pipenv lock --requirements > ./requirements.txt
RUN pip install --no-cache-dir --disable-pip-version-check --requirement ./requirements.txt
# Set Working Directory
RUN mkdir /app
WORKDIR /app
# Copy over project files
COPY "$PWD/joplin" /app/joplin
COPY "$PWD/media" /app
COPY "$PWD/scripts" /app/scripts
COPY "$PWD/docker-entrypoint.sh" /app/docker-entrypoint.sh
COPY "$PWD/gunicorn.conf.py" /app/gunicorn.conf.py
########################################################
# joplin-common => joplin-local
FROM joplin-common as joplin-local
ENV DEPLOYMENT_MODE "LOCAL"
# Run Migrations
ENTRYPOINT ["./docker-entrypoint.sh"]
CMD ["python", "./joplin/manage.py", "runserver", "0.0.0.0:80"]
########################################################
# joplin-common => joplin-deployed
FROM joplin-common as joplin-deployed
# Install nodejs dependencies
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get update; apt-get -y install nodejs
RUN npm install --global yarn
# Build nodejs dependencies for deployed builds
WORKDIR /app/joplin
RUN npm rebuild node-sass
RUN yarn; yarn build
WORKDIR /app
# Start the Joplin server
# Entrypoint must be executed manually since heroku has a 60 second time limit for entrypoint scripts
# we add an extra timeout and debug level to be generous with our server log
CMD ["gunicorn", "-c", "gunicorn.conf.py", "joplin.wsgi:application"]
########################################################
# joplin-common => joplin-deployed => joplin-review
FROM joplin-deployed as joplin-review
ENV DEPLOYMENT_MODE "REVIEW"
########################################################
# joplin-common => joplin-deployed => joplin-staging
FROM joplin-deployed as joplin-staging
ENV DEPLOYMENT_MODE "STAGING"
RUN rm -rf /app/joplin/db
########################################################
# joplin-common => joplin-deployed => joplin-prod
FROM joplin-deployed as joplin-prod
ENV DEPLOYMENT_MODE "PRODUCTION"
RUN rm -rf /app/joplin/db