Skip to content

Commit 7e612d4

Browse files
committed
new container images for minimal alpine runtime
for this commit, image sizes: debian = 812.08 MB alpine = 647.28 MB alpine-slim-terraform = 209.72 MB alpine-slim-tofu = 204.51 MB
1 parent 9d78ee5 commit 7e612d4

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

.github/workflows/atlantis-image.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
attestations: write
5858
strategy:
5959
matrix:
60-
image_type: [alpine, debian]
60+
image_type: [alpine, alpine-slim-terraform, alpine-slim-tofu, debian]
6161
runs-on: ubuntu-24.04
6262
env:
6363
# Set docker repo to either the fork or the main repo where the branch exists
@@ -202,7 +202,7 @@ jobs:
202202
runs-on: ubuntu-24.04
203203
strategy:
204204
matrix:
205-
image_type: [alpine, debian]
205+
image_type: [alpine, alpine-slim-terraform, alpine-slim-tofu, debian]
206206
platform: [linux/arm64/v8, linux/amd64, linux/arm/v7]
207207
env:
208208
# Set docker repo to either the fork or the main repo where the branch exists
@@ -251,7 +251,7 @@ jobs:
251251
name: Build Image
252252
strategy:
253253
matrix:
254-
image_type: [alpine, debian]
254+
image_type: [alpine, alpine-slim-terraform, alpine-slim-tofu, debian]
255255
runs-on: ubuntu-24.04
256256
steps:
257257
- name: Harden Runner

Dockerfile

+12-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ RUN ./download-release.sh \
135135

136136
# Stage 2 - Alpine
137137
# Creating the individual distro builds using targets
138-
FROM alpine:${ALPINE_TAG} AS alpine
138+
FROM alpine:${ALPINE_TAG} AS alpine-base
139139

140140
EXPOSE ${ATLANTIS_PORT:-4141}
141141

@@ -150,9 +150,6 @@ RUN addgroup atlantis && \
150150

151151
# copy atlantis binary
152152
COPY --from=builder /app/atlantis /usr/local/bin/atlantis
153-
# copy terraform binaries
154-
COPY --from=deps /usr/local/bin/terraform/terraform* /usr/local/bin/
155-
COPY --from=deps /usr/local/bin/tofu/tofu* /usr/local/bin/
156153
# copy dependencies
157154
COPY --from=deps /usr/local/bin/conftest /usr/local/bin/conftest
158155
COPY --from=deps /usr/bin/git-lfs /usr/bin/git-lfs
@@ -179,6 +176,17 @@ USER atlantis
179176
ENTRYPOINT ["docker-entrypoint.sh"]
180177
CMD ["server"]
181178

179+
FROM alpine-base as alpine
180+
# copy terraform binaries
181+
COPY --from=deps /usr/local/bin/terraform/terraform* /usr/local/bin/
182+
COPY --from=deps /usr/local/bin/tofu/tofu* /usr/local/bin/
183+
184+
FROM alpine-base as alpine-slim-terraform
185+
COPY --from=deps /usr/local/bin/terraform/terraform /usr/local/bin/terraform
186+
187+
FROM alpine-base as alpine-slim-tofu
188+
COPY --from=deps /usr/local/bin/tofu/tofu /usr/local/bin/tofu
189+
182190
# Stage 2 - Debian
183191
FROM debian-base AS debian
184192

Makefile

+14
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,20 @@ docker/dev: ## Build dev Dockerfile as atlantis-dev
8282
GOOS=linux GOARCH=amd64 go build -o atlantis .
8383
docker build -f Dockerfile.dev -t atlantis-dev .
8484

85+
ALPINE_MINIMAL_VARIANT := terraform
86+
.PHONY: docker/alpine-slim
87+
docker/alpine-slim: ## Build slim terraform or tofu images
88+
docker build --target alpine-slim-$(ALPINE_MINIMAL_VARIANT) -f Dockerfile -t localhost/$(IMAGE_NAME):latest-alpine-slim-$(ALPINE_MINIMAL_VARIANT) .
89+
90+
.PHONY: docker/alpine
91+
docker/alpine: ## Build Dockerfile for alpine runtime target
92+
docker build --target alpine -f Dockerfile -t localhost/$(IMAGE_NAME):latest-alpine .
93+
94+
.PHONY: docker/debian
95+
docker/debian: ## Build Dockerfile for debian runtime target
96+
docker build --target debian -f Dockerfile -t localhost/$(IMAGE_NAME):latest-debian .
97+
98+
8599
.PHONY: release
86100
release: ## Create packages for a release
87101
docker run -v $$(pwd):/go/src/github.com/runatlantis/atlantis cimg/go:1.20 sh -c 'cd /go/src/github.com/runatlantis/atlantis && scripts/binary-release.sh'

0 commit comments

Comments
 (0)