Skip to content

Commit 0967e52

Browse files
DigitallyRefinedeiqnepmgithub-actions[bot]dependabot[bot]
authored
Migrate to Alpine Linux (#2)
* Alpine base image * Update to v3 * chore: autopublish 2023-10-11T18:44:52Z * Copy rinetd.conf + use wg-start.sh * Auto update image when new packages are available * chore: autopublish 2023-10-11T19:40:13Z * Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/login-action from 2 to 3 Bumps [docker/login-action](https://github.com/docker/login-action) from 2 to 3. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](docker/login-action@v2...v3) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/build-push-action from 4 to 5 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 4 to 5. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](docker/build-push-action@v4...v5) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/setup-buildx-action from 2.4.0 to 3.0.0 Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.4.0 to 3.0.0. - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](docker/setup-buildx-action@15c905b...f95db51) --- updated-dependencies: - dependency-name: docker/setup-buildx-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump docker/setup-qemu-action from 2 to 3 Bumps [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) from 2 to 3. - [Release notes](https://github.com/docker/setup-qemu-action/releases) - [Commits](docker/setup-qemu-action@v2...v3) --- updated-dependencies: - dependency-name: docker/setup-qemu-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Bump to v3 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: eiqnepm <86803173+eiqnepm@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent a18a756 commit 0967e52

File tree

8 files changed

+57
-55
lines changed

8 files changed

+57
-55
lines changed

.github/docker-image-built-against

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3565a89d9e81
1+
8ca4688f4f35
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
d4e0a60119a575b851d6b5e6268491f432d91089 refs/heads/main

.github/workflows/build-and-push.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,38 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

16-
- name: Save base image ID
16+
- name: Save image build info
1717
run: |
18-
docker pull ubuntu:jammy
19-
docker images --format '{{.ID}}' ubuntu:jammy > .github/docker-image-built-against
18+
docker pull alpine:3.18
19+
docker images --format '{{.ID}}' alpine:3.18 > .github/docker-image-built-against
20+
git ls-remote https://github.com/samhocevar/rinetd.git main > .github/docker-rinetd-built-against
2021
2122
- name: Set up QEMU
22-
uses: docker/setup-qemu-action@v2
23+
uses: docker/setup-qemu-action@v3
2324

2425
- name: Set up Docker Buildx
25-
uses: docker/setup-buildx-action@15c905b16b06416d2086efa066dd8e3a35cc7f98
26+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
2627
with:
2728
driver-opts: 'image=moby/buildkit:v0.10.5'
2829

2930
- name: Login to GitHub Container Registry
30-
uses: docker/login-action@v2
31+
uses: docker/login-action@v3
3132
with:
3233
registry: ghcr.io
3334
username: ${{ secrets.GHCR_USERNAME }}
3435
password: ${{ secrets.GHCR_TOKEN }}
3536

3637
- name: Build and push
37-
uses: docker/build-push-action@v4
38+
uses: docker/build-push-action@v5
3839
with:
3940
context: .
4041
platforms: linux/amd64,linux/arm64,linux/arm/v7
4142
push: true
4243
tags: |
4344
ghcr.io/digitallyrefined/docker-wireguard-tunnel:latest
44-
ghcr.io/digitallyrefined/docker-wireguard-tunnel:v2
45+
ghcr.io/digitallyrefined/docker-wireguard-tunnel:v3
4546
4647
- name: Commit and push changes
4748
uses: actions-js/push@master

.github/workflows/check-for-updates.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414

15-
- name: Check if base image update available
15+
- name: Check if image needs updating
1616
id: image-update
1717
run: |
18-
docker pull ubuntu:jammy
19-
docker images --format '{{.ID}}' ubuntu:jammy > .github/docker-image-built-against
18+
docker pull alpine:3.18
19+
docker images --format '{{.ID}}' alpine:3.18 > .github/docker-image-built-against
20+
git ls-remote https://github.com/samhocevar/rinetd.git main > .github/docker-rinetd-built-against
2021
img_needs_updating=`git status --porcelain`
2122
set -x
2223
echo "needs-updating=`[[ $img_needs_updating ]] && echo true || echo false`" >>$GITHUB_OUTPUT
@@ -25,39 +26,38 @@ jobs:
2526
id: pkg-update
2627
run: |
2728
docker pull ghcr.io/digitallyrefined/docker-wireguard-tunnel
28-
pkgs_to_update=`docker run --rm ghcr.io/digitallyrefined/docker-wireguard-tunnel bash -c ' \
29-
apt update > /dev/null && \
30-
apt -s -o Debug::NoLocking=true upgrade | { grep ^Inst || true; }'`
29+
pkgs_to_update=`docker run --rm ghcr.io/digitallyrefined/docker-wireguard-tunnel sh -c ' \
30+
apk upgrade --simulate --no-cache | { grep Upgrading || true; }'`
3131
set -x
3232
echo "needs-updating=`[[ $pkgs_to_update ]] && echo true || echo false`" >>$GITHUB_OUTPUT
3333
3434
- name: Set up QEMU
35-
uses: docker/setup-qemu-action@v2
35+
uses: docker/setup-qemu-action@v3
3636
if: steps.image-update.outputs.needs-updating == 'true' || steps.pkg-update.outputs.needs-updating == 'true'
3737

3838
- name: Set up Docker Buildx
39-
uses: docker/setup-buildx-action@15c905b16b06416d2086efa066dd8e3a35cc7f98
39+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
4040
with:
4141
driver-opts: 'image=moby/buildkit:v0.10.5'
4242
if: steps.image-update.outputs.needs-updating == 'true' || steps.pkg-update.outputs.needs-updating == 'true'
4343

4444
- name: Login to GitHub Container Registry
45-
uses: docker/login-action@v2
45+
uses: docker/login-action@v3
4646
with:
4747
registry: ghcr.io
4848
username: ${{ secrets.GHCR_USERNAME }}
4949
password: ${{ secrets.GHCR_TOKEN }}
5050
if: steps.image-update.outputs.needs-updating == 'true' || steps.pkg-update.outputs.needs-updating == 'true'
5151

5252
- name: Build and push
53-
uses: docker/build-push-action@v4
53+
uses: docker/build-push-action@v5
5454
with:
5555
context: .
5656
platforms: linux/amd64,linux/arm64,linux/arm/v7
5757
push: true
5858
tags: |
5959
ghcr.io/digitallyrefined/docker-wireguard-tunnel:latest
60-
ghcr.io/digitallyrefined/docker-wireguard-tunnel:v2
60+
ghcr.io/digitallyrefined/docker-wireguard-tunnel:v3
6161
if: steps.image-update.outputs.needs-updating == 'true' || steps.pkg-update.outputs.needs-updating == 'true'
6262

6363
- name: Commit and push changes

Dockerfile

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
# syntax=docker/dockerfile:1
22

3-
FROM ubuntu:jammy
3+
FROM alpine:3.18 AS builder
4+
5+
RUN set -ex \
6+
&& apk upgrade --no-cache \
7+
&& apk add --no-cache \
8+
build-base \
9+
git \
10+
autoconf \
11+
automake \
12+
&& cd /tmp \
13+
&& git clone --depth=1 "https://github.com/samhocevar/rinetd" \
14+
&& cd rinetd \
15+
&& ./bootstrap \
16+
&& ./configure --prefix=/usr \
17+
&& make -j $(nproc) \
18+
&& strip rinetd
19+
20+
FROM alpine:3.18
421

522
ARG TARGETPLATFORM
623

724
LABEL org.opencontainers.image.source=https://github.com/DigitallyRefined/docker-wireguard-tunnel
825
LABEL org.opencontainers.image.description="docker-wireguard-tunnel ${TARGETPLATFORM}"
926

10-
ENV DEBIAN_FRONTEND=noninteractive
11-
ENV TERM=xterm
12-
13-
RUN \
14-
apt update && \
15-
apt dist-upgrade -y && \
16-
apt install -y --no-install-recommends \
17-
ca-certificates \
18-
curl \
19-
ifupdown \
20-
iproute2 \
21-
iputils-ping \
22-
openresolv \
23-
rinetd \
24-
wireguard-tools && \
25-
apt autoremove -y && \
26-
rm -rf \
27-
/tmp/* \
28-
/var/lib/apt/lists/* \
29-
/var/tmp/*
30-
31-
RUN cp /etc/rinetd.conf /etc/rinetd.conf.ori
32-
33-
COPY wg-start.sh /usr/local/bin/wireguard
34-
35-
CMD ["wireguard"]
27+
COPY --from=builder /tmp/rinetd/rinetd /usr/sbin/rinetd
28+
COPY --from=builder /tmp/rinetd/rinetd.conf /etc/rinetd.conf.ori
29+
30+
RUN apk upgrade --no-cache
31+
RUN apk add --no-cache wireguard-tools
32+
33+
COPY wg-start.sh /usr/sbin/wg-start.sh
34+
35+
CMD ["/usr/sbin/wg-start.sh"]
3636

3737
EXPOSE 51820/udp

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Will accept connections on behalf of a peer and tunnel them to the designated pe
2323
```yml
2424
services:
2525
wireguard-tunnel-server:
26-
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v2
26+
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v3
2727
container_name: wireguard-tunnel-server
2828
environment:
2929
# Update to your domain
@@ -62,7 +62,7 @@ Move the `config/peer1.conf` file from the server that was automatically generat
6262
```yml
6363
services:
6464
wireguard-tunnel-peer:
65-
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v2
65+
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v3
6666
container_name: wireguard-tunnel-peer
6767
environment:
6868
# Note that DOMAIN & PEERS are not required for the peer

example-tls-fly-io.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Will accept connections on behalf of a peer and tunnel them to the designated pe
2020
app = "my-app-1234"
2121

2222
[build]
23-
image = "ghcr.io/digitallyrefined/docker-wireguard-tunnel:v2"
23+
image = "ghcr.io/digitallyrefined/docker-wireguard-tunnel:v3"
2424

2525
[env]
2626
DOMAIN = "my-app-1234.fly.dev" # Update this to match your subdomain
@@ -85,7 +85,7 @@ Paste the `peer1.conf` contents from the Fly.io server into a file named `config
8585
```yml
8686
services:
8787
wireguard-tunnel-peer:
88-
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v2
88+
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v3
8989
container_name: wireguard-tunnel-peer
9090
environment:
9191
# Note that DOMAIN & PEERS are not required for the peer

example-tls-traefik.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ services:
2929
- "traefik"
3030

3131
wireguard-tunnel-server:
32-
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v2
32+
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v3
3333
container_name: wireguard-tunnel-server
3434
environment:
3535
# Update to your domain
@@ -154,7 +154,7 @@ Move the `config/peer1.conf` file from the server that was automatically generat
154154
```yml
155155
services:
156156
wireguard-tunnel-peer:
157-
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v2
157+
image: ghcr.io/digitallyrefined/docker-wireguard-tunnel:v3
158158
container_name: wireguard-tunnel-peer
159159
environment:
160160
# Note that DOMAIN & PEERS are not required for the peer

0 commit comments

Comments
 (0)