13 Commits
Author SHA1 Message Date
marc 52676e0627 npm
Docker / build (push) Canceled after 0s
Pylint / build (push) Canceled after 0s
2022-08-20 01:00:58 +02:00
marc c67e613ba2 local docker cache 2022-08-20 00:48:45 +02:00
marc 76985fa799 Merge branch 'master' into arch 2022-08-20 00:46:15 +02:00
marc 368a74a1c7 docker build test 2022-08-20 00:46:09 +02:00
marc dae43435e4 arch 2022-08-20 00:33:11 +02:00
marc ba7998c636 paru 2022-08-20 00:28:34 +02:00
marc 0ac6f00ef0 arch 2022-08-20 00:26:13 +02:00
marc 2bdc141e2d archlinux first try 2022-08-20 00:11:14 +02:00
marc c1ba069b41 build and push 2022-08-20 00:02:24 +02:00
marc 0271e71974 update apt is slow 2022-08-20 00:01:33 +02:00
marc d209ad28c5 fix mistake 2022-08-19 23:58:22 +02:00
marc 9f5de228b5 trying new docker-push 2022-08-19 23:56:44 +02:00
marc 92871ae135 update 2022-08-19 19:55:11 +02:00
5 changed files with 869 additions and 656 deletions
+47
View File
@@ -0,0 +1,47 @@
name: Docker
on:
push:
branches:
- "*"
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
IMAGE_NAME: website
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker images
uses: docker/build-push-action@v3
with:
context: .
push: false
tags: marcpartensky/website:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
+11 -3
View File
@@ -19,8 +19,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Update apt
run: sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
- name: Install make
run: sudo apt install make -y
- name: Install Python3.7
@@ -36,13 +34,23 @@ jobs:
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
id: build
uses: docker/build-push-action@v2
with:
push: false
tags: marcpartensky/website:latest
- name: Compose up
run: docker-compose -f dev.yml up -d website postgres mysql
- name: Test
run: docker-compose run test
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
id: push
uses: docker/build-push-action@v2
with:
push: true
+13 -11
View File
@@ -1,23 +1,25 @@
FROM python:3.7.12
# ARG timestamp
# ARG commit
FROM marcpartensky/paru:latest as builder
RUN paru -Syyyu --noconfirm python37 python-pipenv npm make
COPY . /app
RUN pipenv update
RUN pipenv run ./manage.py collectstatic --noinput
RUN npm install -g npm@latest
RUN npm install
FROM marcpartensky/paru:latest
LABEL maintainer="marc.partensky@gmail.com"
LABEL image="https://hub.docker.com/r/marcpartensky/website"
LABEL source="https://github.com/marcpartensky/website"
LABEL link="https://marcpartensky.com"
RUN paru -Syyyu --noconfirm python37 npm
# ARG timestamp
# ARG commit
# LABEL build.timestamp=timestamp
# LABEL build.commit=commit
COPY . /app
COPY --from=builder /app /app
WORKDIR /app
RUN apt-get update
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash
RUN apt-get install -y nodejs
RUN npm install -g npm@latest
RUN npm install
# No .pyo and easier debugging
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
Generated
+762 -608
View File
File diff suppressed because it is too large Load Diff
+36 -34
View File
@@ -21,16 +21,6 @@ x-common:
REDIS_URL: redis:6379
services:
# nginx:
# image: jwilder/nginx-proxy
# restart: unless-stopped
# networks:
# - web
# ports:
# - "127.0.1.1:80:80"
# volumes:
# - /var/run/docker.sock:/tmp/docker.sock:ro
website:
image: marcpartensky/website
environment:
@@ -53,6 +43,12 @@ services:
- postgres
networks:
- web
healthcheck:
test: ["CMD", "curl", "-fs", "http://website:80/robots.txt"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
postgres:
image: postgres
@@ -109,32 +105,38 @@ services:
networks:
- web
website-test:
environment:
<<: *website
<<: *postgres
<<: *redis
VIRTUAL_HOST: website.dev
build:
context: .
dockerfile: ./Dockerfile
working_dir: /app
entrypoint: /app/entrypoint.sh
command: 80 0.0.0.0
volumes:
- ".:/app"
# website-test:
# environment:
# <<: *website
# <<: *postgres
# <<: *redis
# VIRTUAL_HOST: website.dev
# build:
# context: .
# dockerfile: ./Dockerfile
# working_dir: /app
# entrypoint: /app/entrypoint.sh
# command: 80 0.0.0.0
# volumes:
# - ".:/app"
# networks:
# - web
# - caddy
# healthcheck:
# test: ["CMD", "curl", "-fs", "http://website:80/robots.txt"]
# interval: 1m30s
# timeout: 10s
# retries: 3
# start_period: 40s
# labels:
# - "caddy=test.marcpartensky.com"
# - "caddy.reverse_proxy={{upstreams http 80}}"
test:
image: jwilder/dockerize
networks:
- web
- caddy
healthcheck:
test: ["CMD", "curl", "-fs", "http://website:80/robots.txt"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
labels:
- "caddy=test.marcpartensky.com"
- "caddy.reverse_proxy={{upstreams http 80}}"
command: -wait http://website:8080/healthcheck -timeout 120s -wait-retry-interval 5s
networks:
web: