-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
60 lines (46 loc) · 1.14 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
# Base image
FROM ubuntu:22.04 AS base
# System dependencies
RUN apt-get update && apt-get install -y \
build-essential \
supervisor \
bash \
gettext \
locate \
autoconf \
libsqlite3-dev \
libzip-dev \
git \
curl \
zip \
unzip \
ca-certificates \
sqlite \
&& rm -rf /var/lib/apt/lists/*
# Create app user
RUN groupadd -g 1000 app && useradd -u 1000 -g 1000 app
# Switch to new user
USER app
# Set working directory to app home
WORKDIR /home/app
# Install asdf
RUN git clone https://github.com/asdf-vm/asdf.git .asdf --branch v0.11.2 && \
echo '. .asdf/asdf.sh' >> .bashrc && \
echo '. .asdf/asdf.sh' >> .profile
# Set global path
ENV PATH="/home/app/.asdf/shims:/home/app/.asdf/bin:${PATH}"
# Install asdf plugins
RUN asdf plugin-add nodejs
# Install runtimes
COPY .tool-versions .
RUN asdf install
# Setup package manager cache directories and app directory
RUN mkdir -p .npm app
# Set working directory to app
WORKDIR /home/app/app
COPY --chown=app:app . .
FROM base as production
# Install node dependencies and build assets
RUN --mount=type=cache,target=.npm,uid=1000,gid=1000 \
npm ci && npm run build
EXPOSE 3000