Compare commits
18
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e77d7c64e | ||
|
|
550419381a | ||
|
|
fc9f4cde3b | ||
|
|
3f2b863f5a | ||
|
|
8231096b4d | ||
|
|
87268abcc3 | ||
|
|
c67e613ba2 | ||
|
|
76985fa799 | ||
|
|
368a74a1c7 | ||
|
|
dae43435e4 | ||
|
|
ba7998c636 | ||
|
|
0ac6f00ef0 | ||
|
|
2bdc141e2d | ||
|
|
c1ba069b41 | ||
|
|
0271e71974 | ||
|
|
d209ad28c5 | ||
|
|
9f5de228b5 | ||
|
|
92871ae135 |
@@ -15,8 +15,6 @@ venv
|
||||
.buildpacks
|
||||
*.pem
|
||||
*.crt
|
||||
Pipfile
|
||||
Pipfile.lock
|
||||
.travis.yml
|
||||
.gitignore
|
||||
.dockerignore
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
+15
-11
@@ -1,23 +1,27 @@
|
||||
FROM python:3.7.12
|
||||
# ARG timestamp
|
||||
# ARG commit
|
||||
FROM marcpartensky/paru:latest as builder
|
||||
RUN paru -Syyyu --noconfirm python-pipenv npm make
|
||||
USER root
|
||||
COPY . /opt/website
|
||||
WORKDIR /opt/website
|
||||
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 python 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
File diff suppressed because it is too large
Load Diff
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user