Merge pull request #269 from paritytech/eg-docker-build

add docker push on release
This commit is contained in:
s3krit
2020-07-21 15:51:49 +02:00
committed by GitHub
6 changed files with 85 additions and 20 deletions
+11
View File
@@ -22,3 +22,14 @@ jobs:
- name: Build release and call executable
working-directory: ./backend
run: cargo run --release -- --help
- name: Build and Push template image
uses: docker/build-push-action@v1 # https://github.com/docker/build-push-action
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: Dockerfile
repository: parity/substrate-telemetry-backend
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: latest
add_git_labels: true
+11
View File
@@ -36,3 +36,14 @@ jobs:
- name: Build
working-directory: ./frontend
run: yarn build
- name: Build and Push template image
uses: docker/build-push-action@v1 # https://github.com/docker/build-push-action
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
dockerfile: Dockerfile
repository: parity/substrate-telemetry-frontend
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: latest
add_git_labels: true
-14
View File
@@ -1,14 +0,0 @@
FROM rust as builder
WORKDIR /build
COPY ./backend .
RUN cargo build --release
#####################################
FROM phusion/baseimage:0.11
COPY --from=builder /build/target/release/telemetry /usr/local/bin
EXPOSE 8000
ENTRYPOINT [ "telemetry" ]
+7 -6
View File
@@ -3,20 +3,21 @@ version: "3"
services:
telemetry-frontend:
build:
dockerfile: frontend.Dockerfile
context: ./
dockerfile: Dockerfile
context: ./frontend/
# Copy in changes to the ui, so no need to rebuild the images.
volumes:
- /app/node_modules
- ./packages:/app/packages
command: yarn start:frontend
ports:
- 3000:3000
- 3000:80
telemetry-backend:
build:
dockerfile: backend.Dockerfile
context: ./
dockerfile: Dockerfile
context: ./backend/
environment:
- PORT=8000
ports:
- 8000:8000
expose:
- 8000
+1
View File
@@ -24,6 +24,7 @@ COPY --from=builder /opt/builder/env.sh /usr/bin/
RUN apk add --no-cache bash; chmod +x /usr/bin/env.sh
COPY --from=builder /opt/builder/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /opt/builder/nginx/default /etc/nginx/sites-available/default
COPY --from=builder /opt/builder/build /usr/share/nginx/html
EXPOSE 80
+55
View File
@@ -0,0 +1,55 @@
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
root /usr/share/nginx/html;
index index.html;
listen 3000;
listen [::]:3000;
server_name telemetry.polkadot.io localhost;
location /feed/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
limit_req zone=zone burst=5;
}
location /submit/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
limit_req zone=zone burst=5;
}
location /network_state/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
limit_req zone=zone burst=5;
}
location /health/ {
proxy_pass http://127.0.0.1:8000;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
limit_req zone=zone burst=5;
}
}