-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
dockerfile-arm
88 lines (76 loc) · 2.82 KB
/
dockerfile-arm
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
# Builder stage for compiling the Yew application
FROM rust:alpine3.19 AS builder
# Install build dependencies
RUN apk update && apk upgrade && \
apk add --no-cache musl-dev libffi-dev zlib-dev jpeg-dev
# Install wasm target and build tools
RUN rustup target add wasm32-unknown-unknown && \
cargo install wasm-bindgen-cli
RUN apk update && apk upgrade
# Add the Edge Community repository
RUN echo "@edge http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories
# Update the package index
RUN apk update
# Install the desired package from the edge community repository
RUN apk add trunk@edge
# Add application files to the builder stage
COPY ./web/Cargo.lock ./web/Cargo.toml ./web/dev-info.md ./web/index.html ./web/tailwind.config.js ./web/Trunk.toml /app/
COPY ./web/src /app/src
COPY ./web/static /app/static
WORKDIR /app
# Initialize trunk first
RUN cd /tmp && \
echo "" > dummy.rs && \
trunk build dummy.rs || true
RUN cargo install --locked wasm-bindgen-cli
# Build the Yew application in release mode
RUN RUSTFLAGS="--cfg=web_sys_unstable_apis" trunk build --features server_build --release
# Final stage for setting up runtime environment
FROM alpine:3.19
# Metadata
LABEL maintainer="Collin Pendleton <collinp@collinpendleton.com>"
# Install runtime dependencies and build deps in one layer
RUN apk update && apk upgrade && \
apk add --no-cache nginx python3 openssl bash mariadb-client curl cronie openrc supervisor \
gcc musl-dev python3-dev python3 && \
python3 -m venv /opt/venv && \
/opt/venv/bin/pip install --upgrade pip && \
rm -rf /var/cache/apk/*
# Set environment variables
ENV PATH="/opt/venv/bin:$PATH"
ENV APP_ROOT=/pinepods
# Copy and install requirements
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir -r /tmp/requirements.txt && \
rm -rf /root/.cache/pip/* && \
apk del gcc musl-dev python3-dev
# Copy wait-for-it script
COPY wait-for-it/wait-for-it.sh /wait-for-it.sh
RUN chmod +x /wait-for-it.sh
# Copy built files from the builder stage
COPY --from=builder /app/dist /var/www/html/
# Set up application directories and files
WORKDIR /
COPY startup/startup.sh /startup.sh
RUN chmod +x /startup.sh
RUN mkdir -p /pinepods /var/log/supervisor/
COPY startup/ /pinepods/startup/
COPY clients/ /pinepods/clients/
COPY database_functions/ /pinepods/database_functions/
RUN chmod +x /pinepods/startup/call_refresh_endpoint.sh \
/pinepods/startup/app_startup.sh \
/pinepods/startup/startup.sh
# Clean things up
RUN rm -rf \
/var/cache/apk/* \
/root/.cache \
/tmp/* \
/var/tmp/* \
/usr/share/man \
/usr/share/doc
# Define and set the version
ARG PINEPODS_VERSION
RUN echo "${PINEPODS_VERSION}" > /pinepods/current_version
# Configure Nginx
COPY startup/nginx.conf /etc/nginx/nginx.conf
ENTRYPOINT ["bash", "/startup.sh"]