From 97f44f81da9c8621d4ba0cd80698e3ac1953aed0 Mon Sep 17 00:00:00 2001 From: Per-Arne Andersen Date: Fri, 15 Jan 2021 08:43:30 +0100 Subject: [PATCH] Github action --- .github/workflows/image.yml | 25 +++++++++++++++++ .travis.yml | 3 ++- Dockerfile | 54 +++++++++++++++++++++++++++---------- 3 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/image.yml diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml new file mode 100644 index 0000000..575f62a --- /dev/null +++ b/.github/workflows/image.yml @@ -0,0 +1,25 @@ +name: build wg-dashboard + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: checkout code + uses: actions/checkout@v2 + - name: install buildx + id: buildx + uses: crazy-max/ghaction-docker-buildx@v1 + with: + version: latest + - name: login to docker hub + run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + - name: build the image + run: | + docker buildx build --push \ + --tag perara/wg-manager:latest \ + --platform linux/amd64,linux/arm64/v8,linux/arm64,linux/arm/v7,linux/arm/v6 . \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 4a0de4a..e7210c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ dist: focal -sudo: required +os: linux +language: python env: global: - DOCKER_REPO=perara/wg-manager diff --git a/Dockerfile b/Dockerfile index 465d15e..236267b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,27 +1,53 @@ -FROM node:14-alpine +FROM ubuntu:20.04 +ENV TZ=Europe/Minsk +ENV DEBIAN_FRONTEND=noninteractive COPY ./wg_dashboard_frontend /tmp/build WORKDIR /tmp/build -RUN apk add --no-cache build-base python3-dev && \ -npm cache clean --force && npm install && npm install -g @angular/cli && \ -ng build --configuration="production" && \ -rm -rf node_modules && \ -apk del build-base python3-dev -FROM alpine:3.12 +RUN apt-get update && apt-get install -y \ + nodejs \ + npm \ + && rm -rf /var/lib/apt/lists/* + + +RUN npm cache clean --force +RUN npm install +RUN npm install @angular/cli +RUN node_modules/@angular/cli/bin/ng build --configuration="production" +RUN rm -rf node_modules +RUN apt-get purge nodejs npm -y + +FROM ubuntu:20.04 LABEL maintainer="per@sysx.no" ENV IS_DOCKER True WORKDIR /app +ENV LIBRARY_PATH=/lib:/usr/lib +ENV TZ=Europe/Oslo +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone +COPY wg_dashboard_backend /app + # Install dependencies -RUN apk add --no-cache --update wireguard-tools py3-gunicorn python3 py3-pip ip6tables +#RUN apk add --no-cache --update wireguard-tools py3-gunicorn python3 py3-pip ip6tables +RUN apt-get update && apt-get install -y \ + wireguard-tools \ + iptables \ + python3 \ + python3-pip \ + python3-dev \ + python3-gunicorn \ + python3-uvicorn \ + gunicorn \ + && rm -rf /var/lib/apt/lists/* + + +RUN pip3 install -r requirements.txt -COPY wg_dashboard_backend /app -ENV LIBRARY_PATH=/lib:/usr/lib # Install dependencies -RUN apk add --no-cache build-base python3-dev libffi-dev jpeg-dev zlib-dev && \ -pip3 install uvicorn && \ -pip3 install -r requirements.txt && \ -apk del build-base python3-dev libffi-dev jpeg-dev zlib-dev +#RUN apk add --no-cache build-base python3-dev libffi-dev jpeg-dev zlib-dev && \ +#pip3 install uvicorn && \ +#pip3 install -r requirements.txt && \ +#apk del build-base python3-dev libffi-dev jpeg-dev zlib-dev # Copy startup scripts COPY docker/ ./startup