Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 421bc36

Browse files
author
Flix
committed
feat: Build docker image
1 parent 78143da commit 421bc36

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/target
2+
/vue

.github/workflows/docker.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Set up QEMU
15+
uses: docker/setup-qemu-action@v2
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v2
18+
- name: Login to DockerHub
19+
uses: docker/login-action@v2
20+
with:
21+
username: ${{ secrets.DOCKERHUB_USERNAME }}
22+
password: ${{ secrets.DOCKERHUB_TOKEN }}
23+
- name: Build and push
24+
uses: docker/build-push-action@v3
25+
with:
26+
context: .
27+
platforms: linux/amd64,linux/arm64
28+
push: true
29+
tags: flixcoder/gameshow:latest

Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM docker.io/rust:slim-bullseye as builder
2+
ARG CARGO_NET_GIT_FETCH_WITH_CLI=true
3+
4+
RUN apt update -yqq \
5+
&& apt install -yqq --no-install-recommends \
6+
build-essential cmake libssl-dev pkg-config git \
7+
&& rustup update \
8+
&& rustup toolchain add stable \
9+
&& rustup default stable
10+
11+
COPY . /app
12+
WORKDIR /app
13+
RUN cargo build --release
14+
15+
16+
FROM debian:bullseye-slim
17+
RUN apt update && apt install -y ca-certificates
18+
RUN mkdir -p /opt/app
19+
WORKDIR /opt/app
20+
21+
COPY --from=builder /app/target/release/gameshow-v2 /usr/local/bin/gameshow-v2
22+
COPY --from=builder /app/questions /opt/app/questions
23+
COPY --from=builder /app/static /opt/app/static
24+
25+
ENV RUST_BACKTRACE=1
26+
ENV BIND_ADDRESS="0.0.0.0:8000"
27+
ENV MAX_NICKNAME_LENGTH=25
28+
29+
CMD ["/usr/local/bin/gameshow-v2"]

0 commit comments

Comments
 (0)