Skip to content

Commit bd839ef

Browse files
Merge pull request #137 from MaddyGuthridge/maddy-prisma
Improve docker file layouts
2 parents 79a93b0 + ff9acd3 commit bd839ef

File tree

6 files changed

+173
-14
lines changed

6 files changed

+173
-14
lines changed

.github/workflows/docker-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
uses: docker/build-push-action@v6
3838
with:
3939
context: .
40-
file: ./Dockerfile
40+
file: ./docker/production.dockerfile
4141
push: true
4242
tags: ${{ steps.meta.outputs.tags }}
4343
labels: ${{ steps.meta.outputs.labels }}

docker/dev.docker-compose.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Minifolio -- dev.docker-compose.yml
2+
# ===================================
3+
#
4+
# This file defines a docker-compose image suitable for development.
5+
#
6+
# Data paths
7+
# ----------
8+
# * The data directory will be set up inside `./data` on the host system
9+
# * The private_data directory will be set up inside `./private_data` on the
10+
# host system.
11+
#
12+
# Running:
13+
# --------
14+
# From the root of the repository, run:
15+
#
16+
# docker compose -f docker/dev.docker-compose.yml up
17+
#
18+
# Testing:
19+
# --------
20+
#
21+
# If you really want to, you might be able to use this to do development
22+
# without actually installing the things you need to work on Minifolio (node,
23+
# etc). You probably shouldn't though.
24+
#
25+
# Note: test suite is currently broken under docker due to inability to remove
26+
# data dir.
27+
#
28+
# Run test suite:
29+
# docker compose -f docker/dev.docker-compose.yml exec minifolio npm t
30+
#
31+
# Run type-checking:
32+
# docker compose -f docker/dev.docker-compose.yml exec minifolio npm run check
33+
#
34+
# Run linting:
35+
# docker compose -f docker/dev.docker-compose.yml exec minifolio npm run lint
36+
#
37+
38+
services:
39+
minifolio:
40+
build:
41+
context: ".."
42+
dockerfile: "docker/dev.dockerfile"
43+
ssh:
44+
- default
45+
46+
hostname: minifolio-dev
47+
restart: always
48+
ports:
49+
- 127.0.0.1:5096:5096/tcp
50+
volumes:
51+
- "../data:/data:rw"
52+
- "../private_data:/private_data:rw"
53+
54+
environment:
55+
HOST: "0.0.0.0"
56+
PORT: 5096
57+
DATA_REPO_PATH: "/data"
58+
PRIVATE_DATA_PATH: "/private_data"
59+
# Request body has max size of 10 MB. Adjust as needed
60+
# https://svelte.dev/docs/kit/adapter-node#Environment-variables-BODY_SIZE_LIMIT
61+
BODY_SIZE_LIMIT: 10M

docker/dev.dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# docker/dev.dockerfile
2+
# =====================
3+
#
4+
# Dockerfile for running the server in dev mode
5+
6+
FROM node:22
7+
8+
# Make volumes be owned by the node user
9+
RUN mkdir /data
10+
RUN chown node:node /data
11+
RUN mkdir /private_data
12+
RUN chown node:node /private_data
13+
14+
# Install Git and SSH
15+
RUN apt install -y openssh-client git
16+
17+
USER node
18+
19+
WORKDIR /home/node/app
20+
21+
# Dependencies
22+
COPY .npmrc .
23+
COPY package.json .
24+
COPY package-lock.json .
25+
RUN npm ci
26+
27+
# Configuration
28+
COPY vite.config.ts .
29+
COPY svelte.config.js .
30+
COPY tsconfig.json .
31+
32+
# Source code
33+
COPY src src
34+
COPY tests tests
35+
COPY static static
36+
37+
RUN ls -al /home/node/app
38+
39+
RUN ["npm", "run", "sync"]
40+
41+
EXPOSE 5096
42+
43+
ENTRYPOINT [ "npm", "run", "dev" ]

docker-compose.yml renamed to docker/production-source.docker-compose.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
1-
# Minifolio
2-
# Example docker-compose.yml
1+
# Minifolio -- production-source.docker-compose.yml
2+
# ==========================================
3+
#
4+
# Example docker-compose.yml for production, but built from source.
5+
#
6+
# Data paths
7+
# ----------
38
#
4-
# Usage:
59
# * The data directory will be set up inside `./data` on the host system
610
# * The private_data directory will be set up inside `./private_data` on the
711
# host system.
12+
#
13+
# Running:
14+
# --------
15+
#
16+
# From the root of the repository, run:
17+
#
18+
# docker compose -f docker/production-source.docker-compose.yml up
19+
820
services:
921
minifolio:
10-
# To build from the local repo, rather than the latest published version:
11-
# Comment out this line
12-
image: maddyguthridge/minifolio
13-
# And uncomment these lines
14-
# build:
15-
# context: .
16-
# ssh:
17-
# - default
22+
build:
23+
context: .
24+
ssh:
25+
- default
1826

1927
hostname: minifolio
2028
restart: always
2129
ports:
2230
- 127.0.0.1:3000:3000/tcp
2331
volumes:
24-
- "./data:/data:rw"
25-
- "./private_data:/private_data:rw"
32+
- "../data:/data:rw"
33+
- "../private_data:/private_data:rw"
2634

2735
environment:
2836
DATA_REPO_PATH: "/data"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Minifolio -- production.docker-compose.yml
2+
# ==========================================
3+
#
4+
# Example docker-compose.yml for production
5+
#
6+
# Data paths
7+
# ----------
8+
#
9+
# * The data directory will be set up inside `./data` on the host system
10+
# * The private_data directory will be set up inside `./private_data` on the
11+
# host system.
12+
#
13+
# Note that you may need to adjust these paths if you copy this file out from
14+
# this repo, since it is written so it works nicely when located inside of the
15+
# `docker/` directory.
16+
#
17+
# Running:
18+
# --------
19+
#
20+
# From the root of the repository, run:
21+
#
22+
# docker compose -f docker/production.docker-compose.yml up
23+
24+
services:
25+
minifolio:
26+
image: maddyguthridge/minifolio
27+
hostname: minifolio
28+
restart: always
29+
ports:
30+
- 127.0.0.1:5097:3000/tcp
31+
volumes:
32+
- "../data:/data:rw"
33+
- "../private_data:/private_data:rw"
34+
35+
environment:
36+
DATA_REPO_PATH: "/data"
37+
PRIVATE_DATA_PATH: "/private_data"
38+
HOST: 0.0.0.0
39+
PORT: 3000
40+
# Request body has max size of 10 MB. Adjust as needed
41+
# https://svelte.dev/docs/kit/adapter-node#Environment-variables-BODY_SIZE_LIMIT
42+
BODY_SIZE_LIMIT: 10M

Dockerfile renamed to docker/production.dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# docker/staging.dockerfile
2+
# =====================
3+
#
4+
# Dockerfile for running the server in production mode.
5+
16
FROM node:22
27

38
# Make volumes be owned by the node user

0 commit comments

Comments
 (0)