Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
"version": "1.10.0",
"resolved": "ghcr.io/devcontainers/features/docker-outside-of-docker@sha256:c2c2cf829505ead8e4892c88c31b6594ae94a2bbb209e16e1fac456c1a3a624e",
"integrity": "sha256:c2c2cf829505ead8e4892c88c31b6594ae94a2bbb209e16e1fac456c1a3a624e"
}
}
}
17 changes: 17 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "Y-code Lab Development Environment",
"dockerComposeFile": "../docker-compose.yml",
"service": "devcontainer-dotnet",
"workspaceFolder": "/home/app/y-code-lab",
"shutdownAction": "stopCompose",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
},
"customizations": {
"vscode": {
"extensions": [
]
}
}
}

46 changes: 46 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Publish Container

on:
push:
branches:
- main
- migration-to-azure

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract image metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}

- name: Build and Push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ FakesAssemblies/
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
.pnpm-store/

# Visual Studio 6 build log
*.plg
Expand Down
49 changes: 30 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,41 @@
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
FROM node:24-alpine AS nodejs

WORKDIR /app

RUN npm install pnpm
COPY src/frontend/package.json src/frontend/pnpm-lock.yaml ./
COPY src/frontend/ ./
RUN npx pnpm approve-builds --all && npx pnpm install
RUN npx pnpx nx build ycode-lab --configuration production


FROM mcr.microsoft.com/dotnet/sdk:10.0-azurelinux3.0 AS build

WORKDIR /app

# copy frontend built files
COPY --from=nodejs /app/dist/ ./out/ClientApp/

# copy csproj and restore as distinct layers
COPY YCodeLab.sln .
COPY YCodeLab/*.csproj ./YCodeLab/
COPY YCodeLabDB/*.csproj ./YCodeLabDB/
RUN dotnet restore
COPY src/YCodeLab/*.csproj ./YCodeLab/
COPY src/YCodeLabDB/*.csproj ./YCodeLabDB/
RUN dotnet restore YCodeLab

# copy everything else and build app
COPY frontend/. ./frontend/
COPY YCodeLab/. ./YCodeLab/
COPY YCodeLabDB/. ./YCodeLabDB/
WORKDIR /app/YCodeLab
COPY src/YCodeLab ./YCodeLab/
COPY src/YCodeLabDB/ ./YCodeLabDB/

RUN apt-get update -yq && apt-get upgrade -yq && apt-get install -yq curl
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
RUN . ~/.bashrc && nvm install 22 && node -v && npm -v
RUN . ~/.bashrc && npm install -g npm
# RUN npm install
RUN dotnet publish -c Release -o out YCodeLab

RUN . ~/.bashrc && dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:10.0-azurelinux3.0 AS runtime

FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS runtime
WORKDIR /app

COPY --from=build /app/out/ ./

EXPOSE 80/tcp
ENV ASPNETCORE_URLS http://+:80
COPY --from=build /app/YCodeLab/out/ ./
ENTRYPOINT ["dotnet", "YCodeLab.dll"]
ENV ASPNETCORE_URLS="http://+:80"

ENTRYPOINT ["dotnet", "YCodeLab.dll"]

55 changes: 0 additions & 55 deletions YCodeLab.sln

This file was deleted.

111 changes: 0 additions & 111 deletions YCodeLabDev.sln

This file was deleted.

54 changes: 54 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
services:

devcontainer-dotnet:
image: mcr.microsoft.com/devcontainers/dotnet:10.0-noble
container_name: y-code-lab-dotnet
hostname: api

volumes:
- '../:/home/app/'
- '/var/run/docker.sock:/var/run/docker.sock'
networks:
- y-code-lab
ports:
- '5010:5010'
- '7010:7010'

cpus: 2.0
mem_limit: 2G
shm_size: 128mb

user: app
working_dir: /home/app/y-code-lab

command: |
sleep infinity


devcontainer-nodejs:
image: mcr.microsoft.com/devcontainers/javascript-node:24-trixie
container_name: y-code-lab-nodejs
hostname: frontend

volumes:
- '../:/home/app'
networks:
- y-code-lab
ports:
- '4200:4200'

cpus: 2.0
mem_limit: 2G
shm_size: 128mb

user: node
working_dir: /home/app/y-code-lab

command: |
sleep infinity


networks:
y-code-lab:
driver: bridge

Loading
Loading