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

Commit

Permalink
feat: Build docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
FlixCoder committed Dec 18, 2022
1 parent 78143da commit 421bc36
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
/vue
29 changes: 29 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Docker

on:
push:
branches:
- "main"

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
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
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: flixcoder/gameshow:latest
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM docker.io/rust:slim-bullseye as builder
ARG CARGO_NET_GIT_FETCH_WITH_CLI=true

RUN apt update -yqq \
&& apt install -yqq --no-install-recommends \
build-essential cmake libssl-dev pkg-config git \
&& rustup update \
&& rustup toolchain add stable \
&& rustup default stable

COPY . /app
WORKDIR /app
RUN cargo build --release


FROM debian:bullseye-slim
RUN apt update && apt install -y ca-certificates
RUN mkdir -p /opt/app
WORKDIR /opt/app

COPY --from=builder /app/target/release/gameshow-v2 /usr/local/bin/gameshow-v2
COPY --from=builder /app/questions /opt/app/questions
COPY --from=builder /app/static /opt/app/static

ENV RUST_BACKTRACE=1
ENV BIND_ADDRESS="0.0.0.0:8000"
ENV MAX_NICKNAME_LENGTH=25

CMD ["/usr/local/bin/gameshow-v2"]

0 comments on commit 421bc36

Please sign in to comment.