Update Dockerfile dependencies

This commit is contained in:
Luis Eduardo
2025-09-27 16:12:36 +00:00
parent b546cc36ba
commit 684dbaa1dd
3 changed files with 106 additions and 118 deletions
@@ -11,24 +11,20 @@ alias la='ls -A'
alias l='ls -CF'
alias ..='cd ..'
alias c='clear'
echo "[OK] aliases set"
# Set the user file-creation mode mask to 000, which allows all
# users read, write, and execute permissions for newly created files.
umask 000
echo "[OK] umask set"
# Run the 'fixperms' task that fixes the permissions of the files and
# directories in the project.
task fixperms
echo "[OK] permissions fixed"
# Configure Git to ignore ownership and file mode changes.
git config --global --add safe.directory '*'
git config --global core.fileMode false
git config --unset core.fileMode
git config core.fileMode false
echo "[OK] git configured"
echo "
───────────────────────────────────────────────
+56 -61
View File
@@ -1,9 +1,5 @@
# To make sure we have the deno and golang binaries
FROM denoland/deno:debian-2.1.9 AS deno
FROM golang:1.23.5-bookworm AS golang
# Set the base image
FROM debian:12.7
FROM golang:1.25-trixie AS golang
FROM debian:trixie
# Declare ARG to make it available in the RUN commands
ARG TARGETPLATFORM
@@ -13,79 +9,81 @@ RUN if [ "${TARGETPLATFORM}" != "linux/amd64" ] && [ "${TARGETPLATFORM}" != "lin
exit 1; \
fi
# Set the general environment variables, and move to temp dir
WORKDIR /app
ENV DEBIAN_FRONTEND="noninteractive"
ENV GOBIN="/usr/local/go/bin"
ENV PATH="$PATH:/usr/local/go/bin"
ENV PATH="$PATH:/usr/local/go-bin"
ENV PATH="$PATH:/usr/local/dl-bin"
ENV GOBIN="/usr/local/go-bin"
RUN mkdir -p /app/temp /usr/local/go-bin /usr/local/dl-bin
WORKDIR /app/temp
# Install deno from docker image
COPY --from=deno /usr/bin/deno /usr/local/bin/deno
# Install golang from docker image
COPY --from=golang /usr/local/go /usr/local/go
# Add PostgreSQL repository and install system dependencies
# https://www.postgresql.org/download/linux/debian/
RUN apt update && apt install -y postgresql-common && \
# Install system dependencies and prepare system
RUN set -e && \
# Create a temp dir for downloads
mkdir /tmp/downloads && cd /tmp/downloads && \
# Add PostgreSQL APT repository
# https://www.postgresql.org/download/linux/debian/
apt update && apt install -y postgresql-common && \
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
# Install APT packages
apt update && apt install -y \
wget unzip tzdata git \
wget unzip tzdata git npm \
postgresql-client-13 postgresql-client-14 \
postgresql-client-15 postgresql-client-16 \
postgresql-client-17 postgresql-client-18 && \
rm -rf /var/lib/apt/lists/*
# Install NodeJS
apt install -y npm && \
npm install -g n@latest && \
n 22.19.0 && \
# Install downloadable binaries
RUN set -e && \
# Install downloadable binaries
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
echo "Downloading arm64 binaries" && \
# Install task
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_arm64.tar.gz && \
wget --no-verbose https://github.com/go-task/task/releases/download/v3.45.4/task_linux_arm64.tar.gz && \
tar -xzf task_linux_arm64.tar.gz && \
mv ./task /usr/local/dl-bin/task && \
mv ./task /usr/local/bin/task && \
# Install goose
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.22.0/goose_linux_arm64 && \
mv ./goose_linux_arm64 /usr/local/dl-bin/goose && \
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.25.0/goose_linux_arm64 && \
mv ./goose_linux_arm64 /usr/local/bin/goose && \
# Install sqlc
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.27.0/sqlc_1.27.0_linux_arm64.tar.gz && \
tar -xzf sqlc_1.27.0_linux_arm64.tar.gz && \
mv ./sqlc /usr/local/dl-bin/sqlc && \
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.30.0/sqlc_1.30.0_linux_arm64.tar.gz && \
tar -xzf sqlc_1.30.0_linux_arm64.tar.gz && \
mv ./sqlc /usr/local/bin/sqlc && \
# Install golangci-lint
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.60.3/golangci-lint-1.60.3-linux-arm64.tar.gz && \
tar -xzf golangci-lint-1.60.3-linux-arm64.tar.gz && \
mv ./golangci-lint-1.60.3-linux-arm64/golangci-lint /usr/local/dl-bin/golangci-lint; \
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v2.5.0/golangci-lint-2.5.0-linux-arm64.tar.gz && \
tar -xzf golangci-lint-2.5.0-linux-arm64.tar.gz && \
mv ./golangci-lint-2.5.0-linux-arm64/golangci-lint /usr/local/bin/golangci-lint; \
else \
echo "Downloading amd64 binaries" && \
# Install task
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz && \
wget --no-verbose https://github.com/go-task/task/releases/download/v3.45.4/task_linux_amd64.tar.gz && \
tar -xzf task_linux_amd64.tar.gz && \
mv ./task /usr/local/dl-bin/task && \
mv ./task /usr/local/bin/task && \
# Install goose
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.22.0/goose_linux_x86_64 && \
mv ./goose_linux_x86_64 /usr/local/dl-bin/goose && \
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.25.0/goose_linux_x86_64 && \
mv ./goose_linux_x86_64 /usr/local/bin/goose && \
# Install sqlc
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.27.0/sqlc_1.27.0_linux_amd64.tar.gz && \
tar -xzf sqlc_1.27.0_linux_amd64.tar.gz && \
mv ./sqlc /usr/local/dl-bin/sqlc && \
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.30.0/sqlc_1.30.0_linux_amd64.tar.gz && \
tar -xzf sqlc_1.30.0_linux_amd64.tar.gz && \
mv ./sqlc /usr/local/bin/sqlc && \
# Install golangci-lint
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.60.3/golangci-lint-1.60.3-linux-amd64.tar.gz && \
tar -xzf golangci-lint-1.60.3-linux-amd64.tar.gz && \
mv ./golangci-lint-1.60.3-linux-amd64/golangci-lint /usr/local/dl-bin/golangci-lint; \
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v2.5.0/golangci-lint-2.5.0-linux-amd64.tar.gz && \
tar -xzf golangci-lint-2.5.0-linux-amd64.tar.gz && \
mv ./golangci-lint-2.5.0-linux-amd64/golangci-lint /usr/local/bin/golangci-lint; \
fi && \
# Make binaries executable
chmod +x /usr/local/dl-bin/*
# Default git config
# https://github.com/golangci/golangci-lint/issues/4033
RUN git config --global --add safe.directory '*'
# Make downloaded binaries executable
chmod +x /usr/local/bin/* && \
# Go to the app dir, delete the temporary dir and create backups dir
WORKDIR /app
RUN rm -rf /app/temp && \
# Clean up downloads and APT cache
mkdir -p /app && cd /app && rm -rf /tmp/downloads && \
rm -rf /var/lib/apt/lists/* && \
# Create backups dir
mkdir /backups && \
chmod 777 /backups
@@ -93,10 +91,10 @@ RUN rm -rf /app/temp && \
# START HERE #
##############
# Copy and install deno dependencies
COPY deno.json .
COPY deno.lock .
RUN deno install
# Copy and install node dependencies
COPY package.json .
COPY package-lock.json .
RUN npm install
# Copy and install go dependencies
COPY go.mod .
@@ -106,14 +104,11 @@ RUN go mod download
# Copy the rest of the files
COPY . .
# Fix permissions if needed
RUN task fixperms
# Build the app
RUN task build
# Copy change-password binary
RUN cp ./dist/change-password /usr/local/bin/change-password && \
RUN set -e && \
task fixperms && \
task build && \
cp ./dist/change-password /usr/local/bin/change-password && \
chmod +x /usr/local/bin/change-password
# Run the app
+50 -53
View File
@@ -1,9 +1,5 @@
# To make sure we have the deno and golang binaries
FROM denoland/deno:debian-2.1.9 AS deno
FROM golang:1.23.5-bookworm AS golang
# Set the base image
FROM debian:12.7
FROM golang:1.25-trixie AS golang
FROM debian:trixie
# Declare ARG to make it available in the RUN commands
ARG TARGETPLATFORM
@@ -13,79 +9,81 @@ RUN if [ "${TARGETPLATFORM}" != "linux/amd64" ] && [ "${TARGETPLATFORM}" != "lin
exit 1; \
fi
# Set the general environment variables, and move to temp dir
WORKDIR /app
ENV DEBIAN_FRONTEND="noninteractive"
ENV GOBIN="/usr/local/go/bin"
ENV PATH="$PATH:/usr/local/go/bin"
ENV PATH="$PATH:/usr/local/go-bin"
ENV PATH="$PATH:/usr/local/dl-bin"
ENV GOBIN="/usr/local/go-bin"
RUN mkdir -p /app/temp /usr/local/go-bin /usr/local/dl-bin
WORKDIR /app/temp
# Install deno from docker image
COPY --from=deno /usr/bin/deno /usr/local/bin/deno
# Install golang from docker image
COPY --from=golang /usr/local/go /usr/local/go
# Add PostgreSQL repository and install system dependencies
# https://www.postgresql.org/download/linux/debian/
RUN apt update && apt install -y postgresql-common && \
# Install system dependencies and prepare system
RUN set -e && \
# Create a temp dir for downloads
mkdir /tmp/downloads && cd /tmp/downloads && \
# Add PostgreSQL APT repository
# https://www.postgresql.org/download/linux/debian/
apt update && apt install -y postgresql-common && \
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && \
# Install APT packages
apt update && apt install -y \
wget unzip tzdata git \
wget unzip tzdata git npm \
postgresql-client-13 postgresql-client-14 \
postgresql-client-15 postgresql-client-16 \
postgresql-client-17 postgresql-client-18 && \
rm -rf /var/lib/apt/lists/*
# Install NodeJS
apt install -y npm && \
npm install -g n@latest && \
n 22.19.0 && \
# Install downloadable binaries
RUN set -e && \
# Install downloadable binaries
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
echo "Downloading arm64 binaries" && \
# Install task
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_arm64.tar.gz && \
wget --no-verbose https://github.com/go-task/task/releases/download/v3.45.4/task_linux_arm64.tar.gz && \
tar -xzf task_linux_arm64.tar.gz && \
mv ./task /usr/local/dl-bin/task && \
mv ./task /usr/local/bin/task && \
# Install goose
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.22.0/goose_linux_arm64 && \
mv ./goose_linux_arm64 /usr/local/dl-bin/goose && \
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.25.0/goose_linux_arm64 && \
mv ./goose_linux_arm64 /usr/local/bin/goose && \
# Install sqlc
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.27.0/sqlc_1.27.0_linux_arm64.tar.gz && \
tar -xzf sqlc_1.27.0_linux_arm64.tar.gz && \
mv ./sqlc /usr/local/dl-bin/sqlc && \
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.30.0/sqlc_1.30.0_linux_arm64.tar.gz && \
tar -xzf sqlc_1.30.0_linux_arm64.tar.gz && \
mv ./sqlc /usr/local/bin/sqlc && \
# Install golangci-lint
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.60.3/golangci-lint-1.60.3-linux-arm64.tar.gz && \
tar -xzf golangci-lint-1.60.3-linux-arm64.tar.gz && \
mv ./golangci-lint-1.60.3-linux-arm64/golangci-lint /usr/local/dl-bin/golangci-lint; \
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v2.5.0/golangci-lint-2.5.0-linux-arm64.tar.gz && \
tar -xzf golangci-lint-2.5.0-linux-arm64.tar.gz && \
mv ./golangci-lint-2.5.0-linux-arm64/golangci-lint /usr/local/bin/golangci-lint; \
else \
echo "Downloading amd64 binaries" && \
# Install task
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz && \
wget --no-verbose https://github.com/go-task/task/releases/download/v3.45.4/task_linux_amd64.tar.gz && \
tar -xzf task_linux_amd64.tar.gz && \
mv ./task /usr/local/dl-bin/task && \
mv ./task /usr/local/bin/task && \
# Install goose
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.22.0/goose_linux_x86_64 && \
mv ./goose_linux_x86_64 /usr/local/dl-bin/goose && \
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.25.0/goose_linux_x86_64 && \
mv ./goose_linux_x86_64 /usr/local/bin/goose && \
# Install sqlc
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.27.0/sqlc_1.27.0_linux_amd64.tar.gz && \
tar -xzf sqlc_1.27.0_linux_amd64.tar.gz && \
mv ./sqlc /usr/local/dl-bin/sqlc && \
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.30.0/sqlc_1.30.0_linux_amd64.tar.gz && \
tar -xzf sqlc_1.30.0_linux_amd64.tar.gz && \
mv ./sqlc /usr/local/bin/sqlc && \
# Install golangci-lint
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.60.3/golangci-lint-1.60.3-linux-amd64.tar.gz && \
tar -xzf golangci-lint-1.60.3-linux-amd64.tar.gz && \
mv ./golangci-lint-1.60.3-linux-amd64/golangci-lint /usr/local/dl-bin/golangci-lint; \
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v2.5.0/golangci-lint-2.5.0-linux-amd64.tar.gz && \
tar -xzf golangci-lint-2.5.0-linux-amd64.tar.gz && \
mv ./golangci-lint-2.5.0-linux-amd64/golangci-lint /usr/local/bin/golangci-lint; \
fi && \
# Make binaries executable
chmod +x /usr/local/dl-bin/*
# Default git config
# https://github.com/golangci/golangci-lint/issues/4033
RUN git config --global --add safe.directory '*'
# Make downloaded binaries executable
chmod +x /usr/local/bin/* && \
# Go to the app dir, delete the temporary dir and create backups dir
WORKDIR /app
RUN rm -rf /app/temp && \
# Clean up downloads and APT cache
mkdir -p /app && cd /app && rm -rf /tmp/downloads && \
rm -rf /var/lib/apt/lists/* && \
# Create backups dir
mkdir /backups && \
chmod 777 /backups
@@ -94,9 +92,8 @@ RUN rm -rf /app/temp && \
##############
# Add the startup script on every bash session
COPY scripts/startup.sh /usr/local/bin/startup.sh
RUN echo "\n\n" >> /root/.bashrc && \
cat /usr/local/bin/startup.sh >> /root/.bashrc
RUN rm -rf /root/.bashrc
COPY .devcontainer/.bashrc /root/.bashrc
# Command just to keep the container running
CMD ["sleep", "infinity"]