-
-
Notifications
You must be signed in to change notification settings - Fork 124
Expand file tree
/
Copy pathDockerfile-slim
More file actions
40 lines (28 loc) · 1012 Bytes
/
Dockerfile-slim
File metadata and controls
40 lines (28 loc) · 1012 Bytes
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
# This Dockerfile constructs a minimal environment in which Grain programs can be compiled.
# The environment is only meant to build Grain programs, not develop the compiler.
FROM ospencer/esy:0.9.2 AS esy
FROM node:22 AS builder
LABEL name="Grain"
LABEL description="Grain CLI"
LABEL vcs-url="https://github.com/grain-lang/grain"
LABEL maintainer="team@grain-lang.org"
COPY . /grain
WORKDIR /grain
# esy does not currently ship linux/arm64 binaries, so we manually patch it in
# Install dependencies but don't allow esy's postinstall script to run
RUN npm ci --ignore-scripts
COPY --from=esy /usr/local /grain/node_modules/esy
# Necessary because we disabled scripts during the original install
RUN npm run prepare
# Build the compiler and CLI
RUN npm run compiler build \
# Remove build files
&& rm -rf compiler/_esy
FROM node:22-slim
COPY --from=builder /grain /grain
WORKDIR /grain
# Link CLI in new image
RUN npm run cli link
# Set up container environment
WORKDIR /
CMD [ "/bin/bash" ]