Skip to content

Commit

Permalink
Merge pull request #1 from xtrime-ru/dev
Browse files Browse the repository at this point in the history
Fix unattended upgrade in container
  • Loading branch information
xtrime-ru authored Jun 25, 2022
2 parents 762ec77 + d8c2eec commit 96be9b2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 6 deletions.
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM alpine:latest as builder
# Docker cant unpack remote archives via ADD command :(
# Lets use multistage build to download and unpack remote archive.
RUN wget https://antizapret.prostovpn.org/container-images/az-vpn/rootfs.tar.xz \
&& mkdir /rootfs-dir \
&& tar -xf /rootfs.tar.xz -C /rootfs-dir/

FROM scratch
COPY --from=builder /rootfs-dir /
RUN wget https://secure.nic.cz/files/knot-resolver/knot-resolver-release.deb --no-check-certificate \
&& dpkg --force-confnew -i knot-resolver-release.deb \
&& rm knot-resolver-release.deb \
&& chmod 1777 /tmp \
&& apt update -y \
&& apt upgrade -y -o Dpkg::Options::="--force-confold" \
&& apt autoremove -y && apt clean

COPY ./init.sh /
ENTRYPOINT ["/init.sh"]
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ Docker image converted from original LXD image.
```shell
git clone https://github.com/xtrime-ru/antizapret-vpn-docker.git antizapret
cd antizapret
./build.sh
docker-compose up -d
docker-compose up -d --build
```
2. Download configuration file for your openvpn client from `client_keys` folder.
There will be udp and tcp versions of the config. For better performance use upd.
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '2.4'
services:
antizapret-vpn:
image: xtrime/antizapret-vpn:latest
build: ./
container_name: antizapret-vpn
restart: unless-stopped
ports:
Expand All @@ -10,7 +11,6 @@ services:
volumes:
- ./client_keys/:/root/easy-rsa-ipsec/CLIENT_KEY/
- ./easyrsa3/:/root/easy-rsa-ipsec/easyrsa3/
entrypoint: bash -c '/root/easy-rsa-ipsec/generate.sh && /usr/sbin/init'
privileged: true
logging:
driver: "json-file"
Expand Down
8 changes: 5 additions & 3 deletions build.sh → init.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
#!/usr/bin/env bash

if [[ ! -f ./easyrsa3/easyrsa ]]
if [[ ! -f /root/easy-rsa-ipsec/easyrsa3/easyrsa ]]
# We need to easyrsa3/pki folder to be persistent.
# But we cant just symlink it, because easyrsa will try to remove it and crash during key regeneration.
# So we replace existing folder with link from host.
then
curl -L https://github.com/OpenVPN/easy-rsa/releases/download/v3.1.0/EasyRSA-3.1.0.tgz | tar -xz
mv EasyRSA-3.1.0 easyrsa3
mv EasyRSA-3.1.0/* /root/easy-rsa-ipsec/easyrsa3
rm -rf EasyRSA-3.1.0/
fi

docker import https://antizapret.prostovpn.org/container-images/az-vpn/rootfs.tar.xz xtrime/antizapret-vpn:latest
/root/easy-rsa-ipsec/generate.sh \
&& exec /usr/sbin/init

0 comments on commit 96be9b2

Please sign in to comment.