-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
62 lines (41 loc) · 1.53 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
ARG NODE_VERSION=20
FROM node:${NODE_VERSION}-slim as build
ARG BUN_VERSION=1.1.4
WORKDIR /build
RUN apt update && apt install -y bash curl unzip && \
curl https://bun.sh/install | bash -s -- bun-v${BUN_VERSION}
ENV PATH="${PATH}:/root/.bun/bin"
# Install node modules
COPY bun.lockb package.json ./
RUN bun install --frozen-lockfile
# Copy application code
COPY . .
# Build application
RUN bun run build
# Remove development dependencies
# Encountered a bug with super slow installs on a populated bun package cache.
# This seems to be related to: https://github.com/oven-sh/bun/issues/4066
# Install only the production dependencies
ENV CI=true
RUN rm -rf node_modules && \
rm -rf /root/.bun/install/cache/ && \
bun install --frozen-lockfile --production
RUN curl -sf https://gobinaries.com/tj/node-prune | sh && \
node-prune
FROM node:${NODE_VERSION}-slim as distribution
LABEL org.opencontainers.image.source = "https://github.com/getactions/app"
# Install curl for healthcheck
RUN apt update && apt install curl -y
ENV NODE_ENV="production"
WORKDIR /app
# Copy built application
# This is Remix related, copying only the files which are required
COPY --from=build --chown=node:node /build/node_modules ./node_modules
COPY --from=build --chown=node:node /build/build ./build
COPY --from=build --chown=node:node /build/public ./public
COPY --from=build --chown=node:node /build/workflows ./workflows
COPY --from=build --chown=node:node /build/package.json .
RUN chown -R node:node /app
USER node
EXPOSE 3000
CMD [ "npm", "run", "start" ]