-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
97 lines (81 loc) · 2.37 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
######################
# Base builder image #
######################
FROM node:18-bookworm as builder_base
ENV \
# locale
LC_ALL=C.UTF-8
RUN apt-get update && apt-get install -y \
curl \
git \
bash \
build-essential \
tini \
openssh-client \
cargo \
jq \
python3-pip \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
# githublab ssh
&& mkdir -p -m 0700 ~/.ssh && ssh-keyscan gitlab.com github.com | sort > ~/.ssh/known_hosts \
&& true
SHELL ["/bin/bash", "-lc"]
####################################
# Base stage for production builds #
####################################
FROM builder_base as production_build
COPY ./docker/entrypoint.sh /docker-entrypoint.sh
WORKDIR /app
COPY . /app
# Set the VITE_ASSET_SET environment variable during the build
ARG VITE_ASSET_SET=neutral
ENV VITE_ASSET_SET=$VITE_ASSET_SET
RUN npm install \
&& chmod a+x /docker-entrypoint.sh \
&& npm run build \
&& true
#########################
# Main production build #
#########################
FROM bash:latest as production
WORKDIR /app
COPY --from=production_build /docker-entrypoint.sh /docker-entrypoint.sh
COPY --from=production_build /app/dist /dist
# Copy build things from production_build so this production image can stay minimalis
RUN chmod a+x /docker-entrypoint.sh \
&& mkdir /deliver \
&& true
ENTRYPOINT ["/docker-entrypoint.sh"]
#####################################
# Base stage for development builds #
#####################################
FROM builder_base as devel_build
WORKDIR /app
COPY ./package-lock.json ./package.json /app
RUN npm install \
&& pip3 install --break-system-packages git-up pre-commit detect-secrets \
&& true
#0############
# Run tests #
#############
FROM devel_build as test
COPY . /app
WORKDIR /app
ENTRYPOINT ["/usr/bin/tini", "--", "docker/entrypoint-test.sh"]
# Re run install to get the service itself installed
RUN npm install \
&& docker/pre_commit_init.sh \
&& true
###########
# Hacking #
###########
FROM devel_build as devel_shell
# Copy everything to the image
WORKDIR /app
COPY . /app
RUN apt-get update && apt-get install -y zsh \
&& sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
&& echo "source /root/.profile" >>/root/.zshrc \
&& true
ENTRYPOINT ["/bin/zsh", "-l"]