make commands for docker images
This commit is contained in:
parent
cd545269a9
commit
9461c8a24b
8 changed files with 36342 additions and 43 deletions
6
.dockerignore
Normal file
6
.dockerignore
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
target/
|
||||||
|
tmp/
|
||||||
|
|
||||||
|
Cargo.lock
|
||||||
|
Dockerfile
|
||||||
|
Makefile.toml
|
39
Dockerfile
Normal file
39
Dockerfile
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
FROM rust:alpine as chef
|
||||||
|
RUN apk add musl-dev pkgconfig openssl openssl-dev
|
||||||
|
ENV OPENSSL_DIR=/usr
|
||||||
|
# RUN rustup default nightly
|
||||||
|
# RUN rustup target add x86_64-unknown-linux-musl
|
||||||
|
RUN cargo install cargo-chef
|
||||||
|
WORKDIR /src
|
||||||
|
|
||||||
|
FROM chef as planner
|
||||||
|
COPY . .
|
||||||
|
RUN cargo chef prepare --recipe-path recipe.json
|
||||||
|
|
||||||
|
FROM chef as builder
|
||||||
|
COPY --from=planner /src/recipe.json recipe.json
|
||||||
|
RUN cargo chef cook --target=x86_64-unknown-linux-musl --release --recipe-path=recipe.json
|
||||||
|
COPY . .
|
||||||
|
RUN cargo build --target=x86_64-unknown-linux-musl --release
|
||||||
|
|
||||||
|
FROM scratch as chef-sitemap-generator
|
||||||
|
COPY --from=builder /src/target/x86_64-unknown-linux-musl/release/sitemap-generator /sitemap-generator
|
||||||
|
CMD [ "/sitemap-generator" ]
|
||||||
|
LABEL service=chef-sitemap-generator
|
||||||
|
LABEL org.opencontainers.image.title="djkato/saleor-sitemap-generator"\
|
||||||
|
org.opencontainers.image.description="Creates and keeps Sitemap.xml uptodate with Saleor." \
|
||||||
|
org.opencontainers.image.url="https://github.com/djkato/saleor-apps-rs"\
|
||||||
|
org.opencontainers.image.source="https://github.com/djkato/saleor-apps-rs"\
|
||||||
|
org.opencontainers.image.authors="Djkáťo <djkatovfx@gmail.com>"\
|
||||||
|
org.opencontainers.image.licenses="PolyForm-Noncommercial-1.0.0"
|
||||||
|
|
||||||
|
FROM scratch as chef-simple-payment-gateway
|
||||||
|
COPY --from=builder /src/target/x86_64-unknown-linux-musl/release/simple-payment-gateway /simple-payment-gateway
|
||||||
|
CMD [ "/simple-payment-gateway" ]
|
||||||
|
LABEL service=chef-simple-payment-gateway
|
||||||
|
LABEL org.opencontainers.image.title="djkato/saleor-simple-payment-gateway"\
|
||||||
|
org.opencontainers.image.description="Payment gateway that adds payment methods that don't need actual verification: Cash on delivery, Cash on warehouse pickup, bank tranfer." \
|
||||||
|
org.opencontainers.image.url="https://github.com/djkato/saleor-apps-rs"\
|
||||||
|
org.opencontainers.image.source="https://github.com/djkato/saleor-apps-rs"\
|
||||||
|
org.opencontainers.image.authors="Djkáťo <djkatovfx@gmail.com>"\
|
||||||
|
org.opencontainers.image.licenses="PolyForm-Noncommercial-1.0.0"
|
39
Makefile.toml
Normal file
39
Makefile.toml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
# Configures the default task to run
|
||||||
|
[tasks.default]
|
||||||
|
alias = "build-containers"
|
||||||
|
|
||||||
|
# Overrides the default build task
|
||||||
|
[tasks.build]
|
||||||
|
alias = "build-containers"
|
||||||
|
|
||||||
|
[tasks.build-sitemap-generator]
|
||||||
|
workspace = false
|
||||||
|
script = '''
|
||||||
|
docker build --rm --target chef-sitemap-generator .
|
||||||
|
docker tag $(docker image ls -q --filter=label=service=chef-sitemap-generator) ghcr.io/djkato/saleor-sitemap-generator
|
||||||
|
'''
|
||||||
|
|
||||||
|
[tasks.build-simple-payment-gateway]
|
||||||
|
workspace = false
|
||||||
|
script = '''
|
||||||
|
docker build --rm --target chef-simple-payment-gateway .
|
||||||
|
docker tag $(docker image ls -q --filter=label=service=chef-simple-payment-gateway) ghcr.io/djkato/saleor-simple-payment-gateway
|
||||||
|
'''
|
||||||
|
|
||||||
|
[tasks.build-containers]
|
||||||
|
workspace = false
|
||||||
|
dependencies = ["build-sitemap-generator", "build-simple-payment-gateway"]
|
||||||
|
|
||||||
|
[tasks.push-containers]
|
||||||
|
workspace = false
|
||||||
|
script = '''
|
||||||
|
docker push ghcr.io/djkato/saleor-sitemap-generator:latest
|
||||||
|
docker push ghcr.io/djkato/saleor-simple-payment-gateway:latest
|
||||||
|
'''
|
||||||
|
|
||||||
|
[tasks.delete-containers]
|
||||||
|
workspace = false
|
||||||
|
script = '''
|
||||||
|
docker image rm $(docker image ls -q --filter=label=service=chef-simple-payment-gateway)
|
||||||
|
docker image rm $(docker image ls -q --filter=label=service=chef-sitemap-generator)
|
||||||
|
'''
|
53
README.md
53
README.md
|
@ -2,11 +2,50 @@
|
||||||
|
|
||||||
This repo contains the following main components:
|
This repo contains the following main components:
|
||||||
|
|
||||||
| Crate | Description |
|
| Crate | Description |
|
||||||
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------- |
|
| ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
||||||
| [**saleor-app-sdk**](https://crates.io/crates/saleor-app-sdk) | Types and utilities for making Saleor Apps |
|
| [**saleor-app-sdk**](https://crates.io/crates/sdk) | Types and utilities for making Saleor Apps |
|
||||||
| [**saleor-app-template**](https://github.com/djkato/saleor-apps-rs/tree/master/saleor-app-template) | Simple template for making Saleor apps using axum |
|
| [**saleor-app-template**](https://github.com/djkato/saleor-apps-rs/tree/master/app-template) | Simple template for making Saleor apps using axum |
|
||||||
| [**saleor-app-sitemap**](https://crates.io/crates/saleor-app-sitemap) | Saleor App for keeping sitemap.xml uptodate |
|
| [**saleor-app-sitemap**](https://github.com/djkato/saleor-apps-rs/tree/master/sitemap-generator) | Saleor App for keeping sitemap.xml uptodate |
|
||||||
|
| [**saleor-app-sitemap**](https://github.com/djkato/saleor-apps-rs/tree/master/simple-payment-gateway) | Saleor App that adds payment methods: Cash on delivery, Cash on warehouse pickup, bank tranfer etc. |
|
||||||
|
|
||||||
|
# Using the apps
|
||||||
|
|
||||||
|
Pick the apps you wanna use from this repo. You can find prebuilt docker images on the right sidebar next to the code tree under "Packages".
|
||||||
|
Simply add the package to your `docker-compose.yml`, for example like so:
|
||||||
|
|
||||||
|
```yml
|
||||||
|
version: "3.4"
|
||||||
|
|
||||||
|
services:
|
||||||
|
redisapl:
|
||||||
|
image: bitnami/redis:latest
|
||||||
|
environment:
|
||||||
|
- ALLOW_EMPTY_PASSWORD=yes
|
||||||
|
ports:
|
||||||
|
- 6380:6379
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- saleor-app-tier
|
||||||
|
volumes:
|
||||||
|
- saleor-redis:/bitnami/redis/data
|
||||||
|
|
||||||
|
saleor-app-simple-gateway:
|
||||||
|
image: ghcr.io/djkato/saleor-simple-payment-gateway:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file:
|
||||||
|
- ./app-simple-gateway.env
|
||||||
|
ports:
|
||||||
|
- "3030:3030"
|
||||||
|
networks:
|
||||||
|
- saleor-app-tier
|
||||||
|
depends_on:
|
||||||
|
- redisapl
|
||||||
|
|
||||||
|
networks:
|
||||||
|
saleor-app-tier:
|
||||||
|
driver: bridge
|
||||||
|
```
|
||||||
|
|
||||||
# Using this repo
|
# Using this repo
|
||||||
|
|
||||||
|
@ -43,3 +82,7 @@ Each workspace member has it's licensed in it's own directory.
|
||||||
|
|
||||||
- saleor-app-sdk, saleor-app-template and the root structure fall under either MIT or Apache 2.0 at your convenience.
|
- saleor-app-sdk, saleor-app-template and the root structure fall under either MIT or Apache 2.0 at your convenience.
|
||||||
- Rest of the apps in this repo fall under `PolyForm-Noncommercial-1.0.md`. If you want to use my apps commercially, each app costs 10€ (or voluntarily more). Upon payment/donation you are allowed to use the given app commercially.
|
- Rest of the apps in this repo fall under `PolyForm-Noncommercial-1.0.md`. If you want to use my apps commercially, each app costs 10€ (or voluntarily more). Upon payment/donation you are allowed to use the given app commercially.
|
||||||
|
|
||||||
|
## Docker images
|
||||||
|
|
||||||
|
To build the docker image, log into ghcr.io via docker like `docker login ghcr.io -u <USER> -p <GITHUB KEY WITH PACKAGE PERMS>` run `cargo make`. To publish, run `cargo push-containers`. If you want to push image to your own place, modify `Makefile.toml` and `Dockerfile` to include your username instead of mine.
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
FROM lukemathwalker/cargo-chef:latest as chef
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
FROM chef AS planner
|
|
||||||
COPY ./Cargo.toml ./Cargo.lock ./
|
|
||||||
COPY ./src ./src
|
|
||||||
RUN cargo chef prepare
|
|
||||||
|
|
||||||
FROM chef AS builder
|
|
||||||
COPY --from=planner /app/recipe.json .
|
|
||||||
RUN cargo chef cook --release
|
|
||||||
COPY . .
|
|
||||||
RUN cargo build --release
|
|
||||||
RUN mv ./target/release/saleor-app-template ./app
|
|
||||||
|
|
||||||
FROM debian:stable-slim AS runtime
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /app/app /usr/local/bin/
|
|
||||||
ENTRYPOINT ["/usr/local/bin/app"]
|
|
3
rust-toolchain.toml
Normal file
3
rust-toolchain.toml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[toolchain]
|
||||||
|
channel = "nightly"
|
||||||
|
targets = ["x86_64-unknown-linux-musl"]
|
|
@ -1,19 +0,0 @@
|
||||||
FROM lukemathwalker/cargo-chef:latest as chef
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
FROM chef AS planner
|
|
||||||
COPY ./Cargo.toml ./Cargo.lock ./
|
|
||||||
COPY ./src ./src
|
|
||||||
RUN cargo chef prepare
|
|
||||||
|
|
||||||
FROM chef AS builder
|
|
||||||
COPY --from=planner /app/recipe.json .
|
|
||||||
RUN cargo chef cook --release
|
|
||||||
COPY . .
|
|
||||||
RUN cargo build --release
|
|
||||||
RUN mv ./target/release/saleor-app-template ./app
|
|
||||||
|
|
||||||
FROM debian:stable-slim AS runtime
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /app/app /usr/local/bin/
|
|
||||||
ENTRYPOINT ["/usr/local/bin/app"]
|
|
36207
sitemap-generator/schema/schema.graphql
Normal file
36207
sitemap-generator/schema/schema.graphql
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue