Skip to content

Commit bdec31e

Browse files
committed
Update Dockerfiles to use debian and better organization
1 parent ca26502 commit bdec31e

File tree

4 files changed

+155
-188
lines changed

4 files changed

+155
-188
lines changed

docker/Dockerfile

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,66 @@
1-
# To make sure we have the node, npm, and golang binaries
2-
FROM node:21.5.0-slim AS node
3-
FROM golang:1.22.5 AS golang
1+
# To make sure we have the node, and golang binaries
2+
FROM node:20.17.0-bookworm AS node
3+
FROM golang:1.23.1-bookworm AS golang
44

5-
# This is the actual image we will use
6-
FROM ubuntu:24.04
5+
# Set the base image, general environment variables, and move to temp dir
6+
FROM debian:12.7
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
ENV PATH="$PATH:/usr/local/go/bin"
9+
WORKDIR /app/temp
710

8-
# Copy node and npm binaries from the node image
9-
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
10-
COPY --from=node /usr/local/bin/node /usr/local/bin/node
11-
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
11+
# Copy node binaries
12+
COPY --from=node /usr/local/bin/ /usr/local/bin/
13+
COPY --from=node /usr/local/include/ /usr/local/include/
14+
COPY --from=node /usr/local/lib/ /usr/local/lib/
15+
COPY --from=node /usr/local/share/ /usr/local/share/
1216

13-
# Copy the golang binaries from the golang image
17+
# Copy the golang binaries
1418
COPY --from=golang /usr/local/go /usr/local/go
1519
ENV PATH="$PATH:/usr/local/go/bin"
1620

17-
# Set general environment variables
18-
ENV DEBIAN_FRONTEND=noninteractive
19-
20-
# Install system dependencies
21-
RUN apt-get update && \
22-
apt-get install -y \
23-
wget=1.21.4-1ubuntu4.1 unzip=6.0-28ubuntu4 git=1:2.43.0-1ubuntu7.1 \
24-
gnupg2=2.4.4-2ubuntu17 lsb-release=12.0-2 tzdata=2024a-2ubuntu1 \
25-
lsof=4.95.0-1build3 && \
26-
rm -rf /var/lib/apt/lists/*
27-
28-
# Add PostgreSQL repository and key
29-
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
30-
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
31-
32-
# Install supported PostgreSQL client versions
33-
RUN apt-get update && \
34-
apt-get install -y postgresql-client-13 postgresql-client-14 \
35-
postgresql-client-15 postgresql-client-16 && \
21+
# Add PostgreSQL repository - https://www.postgresql.org/download/linux/debian/
22+
RUN apt update && apt install -y postgresql-common=248 && \
23+
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
24+
25+
# Install system dependencies and PostgreSQL clients
26+
RUN apt update && \
27+
apt install -y \
28+
wget=1.21.3-1+b2 unzip=6.0-28 git=1:2.39.2-1.1 \
29+
tzdata=2024a-0+deb12u1 lsof=4.95.0-1 \
30+
postgresql-client-13 postgresql-client-14 \
31+
postgresql-client-15 postgresql-client-16 && \
3632
rm -rf /var/lib/apt/lists/*
3733

38-
# Create aliases for the different PostgreSQL client versions
39-
RUN echo 'alias pg_dump_13="/usr/lib/postgresql/13/bin/pg_dump"' >> /etc/bash.bashrc && \
40-
echo 'alias pg_dump_14="/usr/lib/postgresql/14/bin/pg_dump"' >> /etc/bash.bashrc && \
41-
echo 'alias pg_dump_15="/usr/lib/postgresql/15/bin/pg_dump"' >> /etc/bash.bashrc && \
42-
echo 'alias pg_dump_16="/usr/lib/postgresql/16/bin/pg_dump"' >> /etc/bash.bashrc
43-
44-
# Move to temporary directory to install additional tools
45-
WORKDIR /app/temp
46-
47-
# Install task
48-
RUN wget --no-verbose https://github.com/go-task/task/releases/download/v3.37.2/task_linux_amd64.tar.gz && \
34+
# Install downloadable binaries
35+
RUN \
36+
# Install task
37+
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz && \
4938
tar -xzf task_linux_amd64.tar.gz && \
5039
mv ./task /usr/local/bin/task && \
51-
chmod 777 /usr/local/bin/task
52-
53-
# Install GitHub CLI
54-
RUN wget --no-verbose https://github.com/cli/cli/releases/download/v2.52.0/gh_2.52.0_linux_amd64.tar.gz && \
55-
tar -xzf gh_2.52.0_linux_amd64.tar.gz && \
56-
mv gh_2.52.0_linux_amd64/bin/gh /usr/local/bin/gh && \
57-
chmod 777 /usr/local/bin/gh
58-
59-
# Install goose
60-
RUN wget --no-verbose https://github.com/pressly/goose/releases/download/v3.21.1/goose_linux_x86_64 && \
40+
chmod +x /usr/local/bin/task && \
41+
\
42+
# Install GitHub CLI
43+
wget --no-verbose https://github.com/cli/cli/releases/download/v2.55.0/gh_2.55.0_linux_amd64.tar.gz && \
44+
tar -xzf gh_2.55.0_linux_amd64.tar.gz && \
45+
mv gh_2.55.0_linux_amd64/bin/gh /usr/local/bin/gh && \
46+
chmod +x /usr/local/bin/gh && \
47+
\
48+
# Install goose
49+
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.22.0/goose_linux_x86_64 && \
6150
mv ./goose_linux_x86_64 /usr/local/bin/goose && \
62-
chmod 777 /usr/local/bin/goose
63-
64-
# Install sqlc
65-
RUN wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.26.0/sqlc_1.26.0_linux_amd64.tar.gz && \
66-
tar -xzf sqlc_1.26.0_linux_amd64.tar.gz && \
51+
chmod +x /usr/local/bin/goose && \
52+
\
53+
# Install sqlc
54+
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.27.0/sqlc_1.27.0_linux_amd64.tar.gz && \
55+
tar -xzf sqlc_1.27.0_linux_amd64.tar.gz && \
6756
mv ./sqlc /usr/local/bin/sqlc && \
68-
chmod 777 /usr/local/bin/sqlc
69-
70-
# Install golangci-lint
71-
RUN wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz && \
72-
tar -xzf golangci-lint-1.59.1-linux-amd64.tar.gz && \
73-
mv ./golangci-lint-1.59.1-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
74-
chmod 777 /usr/local/bin/golangci-lint
57+
chmod +x /usr/local/bin/sqlc && \
58+
\
59+
# Install golangci-lint
60+
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.60.3/golangci-lint-1.60.3-linux-amd64.tar.gz && \
61+
tar -xzf golangci-lint-1.60.3-linux-amd64.tar.gz && \
62+
mv ./golangci-lint-1.60.3-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
63+
chmod +x /usr/local/bin/golangci-lint
7564

7665
# Install node utilities
7766
RUN npm install --global kill-port
@@ -103,7 +92,7 @@ RUN task build
10392

10493
# Copy change-password binary
10594
RUN cp ./dist/change-password /usr/local/bin/change-password && \
106-
chmod 777 /usr/local/bin/change-password
95+
chmod +x /usr/local/bin/change-password
10796

10897
# Run the app
10998
EXPOSE 8085

docker/Dockerfile.cicd

Lines changed: 51 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,66 @@
1-
# To make sure we have the node, npm, and golang binaries
2-
FROM node:21.5.0-slim AS node
3-
FROM golang:1.22.5 AS golang
1+
# To make sure we have the node, and golang binaries
2+
FROM node:20.17.0-bookworm AS node
3+
FROM golang:1.23.1-bookworm AS golang
44

5-
# This is the actual image we will use
6-
FROM ubuntu:24.04
5+
# Set the base image, general environment variables, and move to temp dir
6+
FROM debian:12.7
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
ENV PATH="$PATH:/usr/local/go/bin"
9+
WORKDIR /app/temp
710

8-
# Copy node and npm binaries from the node image
9-
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
10-
COPY --from=node /usr/local/bin/node /usr/local/bin/node
11-
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
11+
# Copy node binaries
12+
COPY --from=node /usr/local/bin/ /usr/local/bin/
13+
COPY --from=node /usr/local/include/ /usr/local/include/
14+
COPY --from=node /usr/local/lib/ /usr/local/lib/
15+
COPY --from=node /usr/local/share/ /usr/local/share/
1216

13-
# Copy the golang binaries from the golang image
17+
# Copy the golang binaries
1418
COPY --from=golang /usr/local/go /usr/local/go
1519
ENV PATH="$PATH:/usr/local/go/bin"
1620

17-
# Set general environment variables
18-
ENV DEBIAN_FRONTEND=noninteractive
19-
20-
# Install system dependencies
21-
RUN apt-get update && \
22-
apt-get install -y \
23-
wget=1.21.4-1ubuntu4.1 unzip=6.0-28ubuntu4 git=1:2.43.0-1ubuntu7.1 \
24-
gnupg2=2.4.4-2ubuntu17 lsb-release=12.0-2 tzdata=2024a-2ubuntu1 \
25-
lsof=4.95.0-1build3 && \
26-
rm -rf /var/lib/apt/lists/*
27-
28-
# Add PostgreSQL repository and key
29-
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
30-
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
31-
32-
# Install supported PostgreSQL client versions
33-
RUN apt-get update && \
34-
apt-get install -y postgresql-client-13 postgresql-client-14 \
35-
postgresql-client-15 postgresql-client-16 && \
21+
# Add PostgreSQL repository - https://www.postgresql.org/download/linux/debian/
22+
RUN apt update && apt install -y postgresql-common=248 && \
23+
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
24+
25+
# Install system dependencies and PostgreSQL clients
26+
RUN apt update && \
27+
apt install -y \
28+
wget=1.21.3-1+b2 unzip=6.0-28 git=1:2.39.2-1.1 \
29+
tzdata=2024a-0+deb12u1 lsof=4.95.0-1 \
30+
postgresql-client-13 postgresql-client-14 \
31+
postgresql-client-15 postgresql-client-16 && \
3632
rm -rf /var/lib/apt/lists/*
3733

38-
# Create aliases for the different PostgreSQL client versions
39-
RUN echo 'alias pg_dump_13="/usr/lib/postgresql/13/bin/pg_dump"' >> /etc/bash.bashrc && \
40-
echo 'alias pg_dump_14="/usr/lib/postgresql/14/bin/pg_dump"' >> /etc/bash.bashrc && \
41-
echo 'alias pg_dump_15="/usr/lib/postgresql/15/bin/pg_dump"' >> /etc/bash.bashrc && \
42-
echo 'alias pg_dump_16="/usr/lib/postgresql/16/bin/pg_dump"' >> /etc/bash.bashrc
43-
44-
# Move to temporary directory to install additional tools
45-
WORKDIR /app/temp
46-
47-
# Install task
48-
RUN wget --no-verbose https://github.com/go-task/task/releases/download/v3.37.2/task_linux_amd64.tar.gz && \
34+
# Install downloadable binaries
35+
RUN \
36+
# Install task
37+
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz && \
4938
tar -xzf task_linux_amd64.tar.gz && \
5039
mv ./task /usr/local/bin/task && \
51-
chmod 777 /usr/local/bin/task
52-
53-
# Install GitHub CLI
54-
RUN wget --no-verbose https://github.com/cli/cli/releases/download/v2.52.0/gh_2.52.0_linux_amd64.tar.gz && \
55-
tar -xzf gh_2.52.0_linux_amd64.tar.gz && \
56-
mv gh_2.52.0_linux_amd64/bin/gh /usr/local/bin/gh && \
57-
chmod 777 /usr/local/bin/gh
58-
59-
# Install goose
60-
RUN wget --no-verbose https://github.com/pressly/goose/releases/download/v3.21.1/goose_linux_x86_64 && \
40+
chmod +x /usr/local/bin/task && \
41+
\
42+
# Install GitHub CLI
43+
wget --no-verbose https://github.com/cli/cli/releases/download/v2.55.0/gh_2.55.0_linux_amd64.tar.gz && \
44+
tar -xzf gh_2.55.0_linux_amd64.tar.gz && \
45+
mv gh_2.55.0_linux_amd64/bin/gh /usr/local/bin/gh && \
46+
chmod +x /usr/local/bin/gh && \
47+
\
48+
# Install goose
49+
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.22.0/goose_linux_x86_64 && \
6150
mv ./goose_linux_x86_64 /usr/local/bin/goose && \
62-
chmod 777 /usr/local/bin/goose
63-
64-
# Install sqlc
65-
RUN wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.26.0/sqlc_1.26.0_linux_amd64.tar.gz && \
66-
tar -xzf sqlc_1.26.0_linux_amd64.tar.gz && \
51+
chmod +x /usr/local/bin/goose && \
52+
\
53+
# Install sqlc
54+
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.27.0/sqlc_1.27.0_linux_amd64.tar.gz && \
55+
tar -xzf sqlc_1.27.0_linux_amd64.tar.gz && \
6756
mv ./sqlc /usr/local/bin/sqlc && \
68-
chmod 777 /usr/local/bin/sqlc
69-
70-
# Install golangci-lint
71-
RUN wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz && \
72-
tar -xzf golangci-lint-1.59.1-linux-amd64.tar.gz && \
73-
mv ./golangci-lint-1.59.1-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
74-
chmod 777 /usr/local/bin/golangci-lint
57+
chmod +x /usr/local/bin/sqlc && \
58+
\
59+
# Install golangci-lint
60+
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.60.3/golangci-lint-1.60.3-linux-amd64.tar.gz && \
61+
tar -xzf golangci-lint-1.60.3-linux-amd64.tar.gz && \
62+
mv ./golangci-lint-1.60.3-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
63+
chmod +x /usr/local/bin/golangci-lint
7564

7665
# Install node utilities
7766
RUN npm install --global kill-port

docker/Dockerfile.dev

Lines changed: 51 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,66 @@
1-
# To make sure we have the node, npm, and golang binaries
2-
FROM node:21.5.0-slim AS node
3-
FROM golang:1.22.5 AS golang
1+
# To make sure we have the node, and golang binaries
2+
FROM node:20.17.0-bookworm AS node
3+
FROM golang:1.23.1-bookworm AS golang
44

5-
# This is the actual image we will use
6-
FROM ubuntu:24.04
5+
# Set the base image, general environment variables, and move to temp dir
6+
FROM debian:12.7
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
ENV PATH="$PATH:/usr/local/go/bin"
9+
WORKDIR /app/temp
710

8-
# Copy node and npm binaries from the node image
9-
COPY --from=node /usr/local/lib/node_modules /usr/local/lib/node_modules
10-
COPY --from=node /usr/local/bin/node /usr/local/bin/node
11-
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
11+
# Copy node binaries
12+
COPY --from=node /usr/local/bin/ /usr/local/bin/
13+
COPY --from=node /usr/local/include/ /usr/local/include/
14+
COPY --from=node /usr/local/lib/ /usr/local/lib/
15+
COPY --from=node /usr/local/share/ /usr/local/share/
1216

13-
# Copy the golang binaries from the golang image
17+
# Copy the golang binaries
1418
COPY --from=golang /usr/local/go /usr/local/go
1519
ENV PATH="$PATH:/usr/local/go/bin"
1620

17-
# Set general environment variables
18-
ENV DEBIAN_FRONTEND=noninteractive
19-
20-
# Install system dependencies
21-
RUN apt-get update && \
22-
apt-get install -y \
23-
wget=1.21.4-1ubuntu4.1 unzip=6.0-28ubuntu4 git=1:2.43.0-1ubuntu7.1 \
24-
gnupg2=2.4.4-2ubuntu17 lsb-release=12.0-2 tzdata=2024a-2ubuntu1 \
25-
lsof=4.95.0-1build3 && \
26-
rm -rf /var/lib/apt/lists/*
27-
28-
# Add PostgreSQL repository and key
29-
RUN echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
30-
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
31-
32-
# Install supported PostgreSQL client versions
33-
RUN apt-get update && \
34-
apt-get install -y postgresql-client-13 postgresql-client-14 \
35-
postgresql-client-15 postgresql-client-16 && \
21+
# Add PostgreSQL repository - https://www.postgresql.org/download/linux/debian/
22+
RUN apt update && apt install -y postgresql-common=248 && \
23+
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y
24+
25+
# Install system dependencies and PostgreSQL clients
26+
RUN apt update && \
27+
apt install -y \
28+
wget=1.21.3-1+b2 unzip=6.0-28 git=1:2.39.2-1.1 \
29+
tzdata=2024a-0+deb12u1 lsof=4.95.0-1 \
30+
postgresql-client-13 postgresql-client-14 \
31+
postgresql-client-15 postgresql-client-16 && \
3632
rm -rf /var/lib/apt/lists/*
3733

38-
# Create aliases for the different PostgreSQL client versions
39-
RUN echo 'alias pg_dump_13="/usr/lib/postgresql/13/bin/pg_dump"' >> /etc/bash.bashrc && \
40-
echo 'alias pg_dump_14="/usr/lib/postgresql/14/bin/pg_dump"' >> /etc/bash.bashrc && \
41-
echo 'alias pg_dump_15="/usr/lib/postgresql/15/bin/pg_dump"' >> /etc/bash.bashrc && \
42-
echo 'alias pg_dump_16="/usr/lib/postgresql/16/bin/pg_dump"' >> /etc/bash.bashrc
43-
44-
# Move to temporary directory to install additional tools
45-
WORKDIR /app/temp
46-
47-
# Install task
48-
RUN wget --no-verbose https://github.com/go-task/task/releases/download/v3.37.2/task_linux_amd64.tar.gz && \
34+
# Install downloadable binaries
35+
RUN \
36+
# Install task
37+
wget --no-verbose https://github.com/go-task/task/releases/download/v3.38.0/task_linux_amd64.tar.gz && \
4938
tar -xzf task_linux_amd64.tar.gz && \
5039
mv ./task /usr/local/bin/task && \
51-
chmod 777 /usr/local/bin/task
52-
53-
# Install GitHub CLI
54-
RUN wget --no-verbose https://github.com/cli/cli/releases/download/v2.52.0/gh_2.52.0_linux_amd64.tar.gz && \
55-
tar -xzf gh_2.52.0_linux_amd64.tar.gz && \
56-
mv gh_2.52.0_linux_amd64/bin/gh /usr/local/bin/gh && \
57-
chmod 777 /usr/local/bin/gh
58-
59-
# Install goose
60-
RUN wget --no-verbose https://github.com/pressly/goose/releases/download/v3.21.1/goose_linux_x86_64 && \
40+
chmod +x /usr/local/bin/task && \
41+
\
42+
# Install GitHub CLI
43+
wget --no-verbose https://github.com/cli/cli/releases/download/v2.55.0/gh_2.55.0_linux_amd64.tar.gz && \
44+
tar -xzf gh_2.55.0_linux_amd64.tar.gz && \
45+
mv gh_2.55.0_linux_amd64/bin/gh /usr/local/bin/gh && \
46+
chmod +x /usr/local/bin/gh && \
47+
\
48+
# Install goose
49+
wget --no-verbose https://github.com/pressly/goose/releases/download/v3.22.0/goose_linux_x86_64 && \
6150
mv ./goose_linux_x86_64 /usr/local/bin/goose && \
62-
chmod 777 /usr/local/bin/goose
63-
64-
# Install sqlc
65-
RUN wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.26.0/sqlc_1.26.0_linux_amd64.tar.gz && \
66-
tar -xzf sqlc_1.26.0_linux_amd64.tar.gz && \
51+
chmod +x /usr/local/bin/goose && \
52+
\
53+
# Install sqlc
54+
wget --no-verbose https://github.com/sqlc-dev/sqlc/releases/download/v1.27.0/sqlc_1.27.0_linux_amd64.tar.gz && \
55+
tar -xzf sqlc_1.27.0_linux_amd64.tar.gz && \
6756
mv ./sqlc /usr/local/bin/sqlc && \
68-
chmod 777 /usr/local/bin/sqlc
69-
70-
# Install golangci-lint
71-
RUN wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.59.1/golangci-lint-1.59.1-linux-amd64.tar.gz && \
72-
tar -xzf golangci-lint-1.59.1-linux-amd64.tar.gz && \
73-
mv ./golangci-lint-1.59.1-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
74-
chmod 777 /usr/local/bin/golangci-lint
57+
chmod +x /usr/local/bin/sqlc && \
58+
\
59+
# Install golangci-lint
60+
wget --no-verbose https://github.com/golangci/golangci-lint/releases/download/v1.60.3/golangci-lint-1.60.3-linux-amd64.tar.gz && \
61+
tar -xzf golangci-lint-1.60.3-linux-amd64.tar.gz && \
62+
mv ./golangci-lint-1.60.3-linux-amd64/golangci-lint /usr/local/bin/golangci-lint && \
63+
chmod +x /usr/local/bin/golangci-lint
7564

7665
# Install node utilities
7766
RUN npm install --global kill-port

0 commit comments

Comments
 (0)