parent
bec0e738d1
commit
3614ab6ba5
@ -1,22 +1,18 @@ |
||||
FROM golang:1.14.2-alpine3.11 AS backend-builder |
||||
FROM golang:1.14.2-buster AS backend-builder |
||||
COPY . /app |
||||
#RUN apk --no-cache add build-base git gcc |
||||
RUN cd /app && env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-extldflags "-static" -s -w' -o openvpn-admin |
||||
RUN cd /app && env CGO_ENABLED=./1 GOOS=linux GOARCH=amd64 go build -ldflags='-linkmode external -extldflags "-static" -s -w' -o openvpn-admin |
||||
|
||||
FROM node:14.2-alpine3.11 AS frontend-builder |
||||
COPY frontend/ /app |
||||
RUN cd /app && npm install && npm run build |
||||
|
||||
FROM golang:1.14.2-buster AS user-builder |
||||
RUN git clone https://github.com/pashcovich/openvpn-user /app && cd /app && env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags='-linkmode external -extldflags "-static" -s -w' -o openvpn-user |
||||
|
||||
FROM alpine:3.13 |
||||
WORKDIR /app |
||||
COPY --from=backend-builder /app/openvpn-admin /app |
||||
COPY --from=user-builder /app/openvpn-user /usr/local/bin |
||||
COPY --from=frontend-builder /app/static /app/static |
||||
COPY client.conf.tpl /app/client.conf.tpl |
||||
COPY ccd.tpl /app/ccd.tpl |
||||
RUN apk add --update bash easy-rsa && \ |
||||
ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \ |
||||
wget https://github.com/pashcovich/openvpn-user/releases/download/v1.0.3-rc.1/openvpn-user-linux-amd64.tar.gz -O - | tar xz -C /usr/local/bin && \ |
||||
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* |
||||
|
@ -1,10 +1,7 @@ |
||||
FROM golang:1.14.2-buster AS user-builder |
||||
RUN git clone https://github.com/pashcovich/openvpn-user /app && cd /app && env CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags='-linkmode external -extldflags "-static" -s -w' -o openvpn-user |
||||
|
||||
FROM alpine:3.13 |
||||
COPY --from=user-builder /app/openvpn-user /usr/local/bin |
||||
RUN apk add --update bash openvpn easy-rsa && \ |
||||
ln -s /usr/share/easy-rsa/easyrsa /usr/local/bin && \ |
||||
wget https://github.com/pashcovich/openvpn-user/releases/download/v1.0.3-rc.1/openvpn-user-linux-amd64.tar.gz -O - | tar xz -C /usr/local/bin && \ |
||||
rm -rf /tmp/* /var/tmp/* /var/cache/apk/* /var/cache/distfiles/* |
||||
COPY .werffiles /etc/openvpn/setup |
||||
COPY setup/ /etc/openvpn/setup |
||||
RUN chmod +x /etc/openvpn/setup/configure.sh |
||||
|
@ -1,3 +1,3 @@ |
||||
#!/bin/bash |
||||
|
||||
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags='-extldflags "-static" -s -w' -o openvpn-admin |
||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags "-linkmode external -extldflags -static -s -w" -o openvpn-admin |
||||
|
@ -1,120 +0,0 @@ |
||||
project: openvpn-admin |
||||
configVersion: 1 |
||||
deploy: |
||||
helmRelease: "[[ project ]]-[[ env ]]" |
||||
namespace: "[[ project ]]-[[ env ]]" |
||||
|
||||
--- |
||||
artifact: backend-builder |
||||
from: golang:1.14.2-alpine3.11 |
||||
git: |
||||
- add: / |
||||
to: /app |
||||
stageDependencies: |
||||
install: |
||||
- "*.go" |
||||
excludePaths: |
||||
- .helm |
||||
- .werf |
||||
- frontend |
||||
- werf.yaml |
||||
- Dockerfile |
||||
ansible: |
||||
install: |
||||
- name: Install packages |
||||
apk: |
||||
name: |
||||
- build-base |
||||
- gcc |
||||
- name: Build backend |
||||
command: go build -ldflags='-extldflags "-static" -s -w' -o openvpn-admin |
||||
environment: |
||||
CGO_ENABLED: 0 |
||||
GOOS: linux |
||||
GOARCH: amd64 |
||||
args: |
||||
chdir: /app |
||||
|
||||
--- |
||||
artifact: frontend-builder |
||||
from: node:14.2-alpine3.11 |
||||
git: |
||||
- add: /frontend |
||||
to: /app |
||||
stageDependencies: |
||||
install: |
||||
- "**/*" |
||||
excludePaths: |
||||
- Dockerfile |
||||
- build.sh |
||||
- werf.yaml |
||||
ansible: |
||||
setup: |
||||
- name: install deps |
||||
command: npm install |
||||
args: |
||||
chdir: /app |
||||
- name: Build app |
||||
command: npm run build |
||||
args: |
||||
chdir: /app |
||||
|
||||
--- |
||||
image: openvpn-admin |
||||
from: alpine:3.11 |
||||
import: |
||||
- artifact: backend-builder |
||||
add: /app/openvpn-admin |
||||
to: /usr/bin/openvpn-admin |
||||
before: setup |
||||
- artifact: frontend-builder |
||||
add: /app/static |
||||
to: /app/static |
||||
before: setup |
||||
git: |
||||
- add: /client.conf.tpl |
||||
to: /app/client.conf.tpl |
||||
stageDependencies: |
||||
setup: |
||||
- "*" |
||||
- add: /ccd.tpl |
||||
to: /app/ccd.tpl |
||||
stageDependencies: |
||||
setup: |
||||
- "*" |
||||
ansible: |
||||
install: |
||||
- name: Install packages |
||||
apk: |
||||
name: |
||||
- easy-rsa |
||||
- bash |
||||
- name: Create symbolic link for easy-rsa |
||||
file: |
||||
src: "/usr/share/easy-rsa/easyrsa" |
||||
dest: "/usr/local/bin/easyrsa" |
||||
state: link |
||||
|
||||
--- |
||||
image: openvpn |
||||
from: alpine:3.11 |
||||
git: |
||||
- add: /.werffiles/ |
||||
to: /etc/openvpn/setup/ |
||||
stageDependencies: |
||||
install: |
||||
- "*" |
||||
ansible: |
||||
install: |
||||
- name: Install packages |
||||
apk: |
||||
name: |
||||
- openvpn |
||||
- easy-rsa |
||||
- name: Create symbolic link for easy-rsa |
||||
file: |
||||
src: "/usr/share/easy-rsa/easyrsa" |
||||
dest: "/usr/local/bin/easyrsa" |
||||
state: link |
||||
|
||||
|
Loading…
Reference in new issue