-
-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathDockerfile
More file actions
71 lines (49 loc) · 1.45 KB
/
Dockerfile
File metadata and controls
71 lines (49 loc) · 1.45 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
# Multi-stage Dockerfile for organice
# Supports both development and production builds
FROM node:20.17.0-bookworm AS base
WORKDIR /opt/organice
# Copy package files
COPY package.json yarn.lock /opt/organice/
# Development stage
FROM base AS development
# Copy source code
COPY . /opt/organice
# Generate environment variables
RUN bin/transient_env_vars.sh bait >> .env
# Create non-root user
RUN groupadd organice \
&& useradd -g organice organice \
&& chown -R organice: /opt/organice
USER organice
# Install dependencies
RUN yarn install
ENV NODE_ENV=development
EXPOSE 3000
CMD ["/bin/bash"]
# Build stage
FROM base AS build
# Copy source code
COPY . /opt/organice
# Install dependencies, including devDependencies like Parcel
RUN yarn install --frozen-lockfile
# Generate environment variables
RUN bin/transient_env_vars.sh bait >> .env
# Build the application
RUN yarn build
# Production stage
FROM node:20.17.0-bookworm-slim AS production
RUN npm install -g serve
WORKDIR /opt/organice
# Copy built application and necessary files from build stage
COPY --from=build /opt/organice/dist ./build/
COPY --from=build /opt/organice/bin ./bin/
COPY --from=build /opt/organice/package.json .
COPY --from=build /opt/organice/.env .
# Create non-root user
RUN groupadd organice \
&& useradd -g organice organice \
&& chown -R organice: /opt/organice
USER organice
ENV NODE_ENV=production
EXPOSE 5000
ENTRYPOINT ["./bin/entrypoint.sh"]