-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
80 lines (62 loc) · 2.17 KB
/
Dockerfile
File metadata and controls
80 lines (62 loc) · 2.17 KB
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
79
80
# syntax=docker/dockerfile:1.7-labs
# File: Dockerfile
# Project: wardrobe
# Created Date: 2026-02-01 22:07:42
# Author: 3urobeat
#
# Last Modified: 2026-03-23 17:31:16
# Modified By: 3urobeat
#
# Copyright (c) 2026 3urobeat <https://github.com/3urobeat>
#
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
# You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
# Install dependencies in a separate container to speed up actual image creation
FROM node:lts-alpine AS temp
RUN mkdir -p /usr/wardrobe-temp
WORKDIR /usr/wardrobe-temp
# Install dependencies for canvas library
RUN apk add --update --no-cache \
make \
g++ \
jpeg-dev \
cairo-dev \
giflib-dev \
pango-dev
# Install production dependencies
ENV NODE_ENV production
COPY package.json package-lock.json ./
RUN npm ci
#&& npm cache clean --force
# Build the actual image
FROM node:lts-alpine
# Create destination directory
RUN mkdir -p /usr/src/wardrobe
WORKDIR /usr/src/wardrobe
# Install runtime dependencies for canvas library
RUN apk add --update --no-cache \
jpeg-dev \
cairo-dev \
giflib-dev \
pango-dev
# Set ownership and switch to unprivileged user
RUN chown -R node:node ./
USER node
# Copy dependencies over from temp container
COPY --from=temp --chown=node:node /usr/wardrobe-temp/ .
RUN ls -al ./
# Copy and build the app itself afterwards, note .dockerignore
COPY --chown=node:node . ./
RUN npm run build
RUN ls -al ./
# Install defaults
RUN mv ./data/defaults/* ./data
RUN rmdir ./data/defaults
# Expose port 3000 which nuxt uses
EXPOSE 3000
ENV NUXT_HOST=0.0.0.0
ENV NUXT_PORT=3000
ENV WARDROBE_HOST_ENV docker
# Start the application
CMD [ "npm", "run", "start" ]